Write to OPC UA varible using the PLCInputFloat datatype

DAT 5 years ago in OPCUA4Unity updated by Support 5 years ago 10

Can you write to OPC UA variable using the PLCInputFloat varible type. I easily read values from the PLCOutputFloat inside scripts using the "variableName".Value method but I cannot seem to write using the datatypes.

I am able to change to variables on OPC UA server using other applications.



I am sending you via email a link to the current beta asset!

Under review

Hi, for writing per code directly to the OPCUA server I would recommend to do it using the OPCUA nodes ike described down here:


If should also work like you described. Do you have a simple model to check what you did? If not I will build a demo myself tomorrow.

I do have a relative simple scene to test with if that is what you mean, but I am using kepware to create the OPC UA server, which I have only created 3 tags on, all of which are read/write.

I have tested that i can write to these tags using siemens OPC scout and simit.

Btw I saw that the OPC Interface have some issues working on hololenses, does it function correctly on VR headsets such as the oculus rift and quest?

I forgot to mention that i can write OPC UA value using the direct method show in the documention :

Interface.WriteNodeValue("ns=2;s=Channel1.Device1.W1 Set", Value);

Hi, I checked and it should work.
Did you checked Subscribe Value in the OPCUA_Node to on (see picture of my test scene)?

I also attach my test scene and you can check if the UaCPPServer yourself:


And yes it works correctly on VR Headsets (because it still runs on normal windows). The issue is that OPCUA currently just don't compiles with Hololens as destination device. 

And if this does not helps please send a link to info@game4automation.com with a  download of a model where we can test and see your problems

The write function is not working in your scene either: the following error gets thrown

NullReferenceException: Object reference not set to an instance of an object
game4automation.PLCInputFloat.SetValue (System.Object value) (at Assets/game4automation/private/Interfaces/PLCInputFloat.cs:81)
game4automation.OPCUA_Node.UpdatePLCSignal () (at Assets/game4automation/private/Interfaces/OPCUA4Unity/OPCUA_Node.cs:180)
game4automation.OPCUA_Node.Start () (at Assets/game4automation/private/Interfaces/OPCUA4Unity/OPCUA_Node.cs:283)

Btw I did opc running on my VRheadset, but the oculus quest uses android not windows. but i noticed that after switching my target environment, the "PLC Output float" and "PLC Input Float" scripts was removed from imported OPC signals.

Please try using this OPCUA_Node.cs. 


I am currently preparing a new release and everything should be fine there.

I hope that the script is helping you.

Yes, if you switch the target device you need to add the DEFINES to the scripting define  symbols:

Alternatively you can - after switching the target defive - again push on Apply Standard Settings:

If all this does not works for you please send me an example.We will get it work ;-)


I am sending you via email a link to the current beta asset!


is your problem solved?

Best regards