Successfully connected HighByte Intelligence Hub to Unity3D with SparkplugB!Β β
π I am sending data from my Automation-Gateway.com to the Intelligence Hub via OPC UA, then the values are published from HighByte to MQTT with the Intelligence Hub SparkplugB connector and then getting consumed in Unity with the MQTT SparkplugB Asset.
π Works straight forward and was easy to setup!
π§ Sparkplug Learning: If a Host Application is not the Primary Host of an Edge Node and it starts up after the Edge Node, it must send the Rebirth command to the Edge Nodes in which it is interested in, to get a birth message with the current/initial values of all the metrics of the nodes. My Unity client ignores incoming metrics of DATA messages which it has not seen before in a BIRTH message…
Unlock the potential of industrial data from SparkplugB enabled devices, seamlessly integrated into Unity3D to build 3D applications?
Or start creating industry Apps for Apple’s Vision Pro with SparkplugB connectivity? πΆοΈ
π‘ I completed a SparkplugB π implementation for Unity. The primary objective was to acquire a hands-on understanding of SparkplugB.
π You can find it for free on GitHub It’s made on top of the “MQTT for Unity” Asset.
Disclaimer: There is no assurance that I have captured all the rules within the extensive 140-page SparkplugB specification. While Unity supports visionOS, I have not conducted testing on this platform.
If you are getting errors like “Missing JToken” with the GraphQL for Unity (Pro) Asset, then open the package manager and choose “add from git url” and give this url: com.unity.nuget.newtonsoft-json
With WinCC Unified V19 we got the feature to read history values of logged tags with GraphQL π I have now added this functionality to the GraphQL for Unity Pro Asset π€
π₯ With that done it is now also very easy to read the history of logged tags in Unity3D. See the video, there we read and visualize the history values of a tag when the application starts. And then the 3D chart gets updated with real-time values coming from a GraphQL tag subscription.
βΉοΈ The GraphQL for Unity Pro Asset has a WinCC Unified interface on top of GraphQL to make the access to WinCC Unified data in Unity even more easier, you do not need to implement the GraphQL queries by your own.
π You can try the demo in the browser! This is possible because the asset als supports WebGL builds and because GraphQL is transported over HTTP&Websockets. Here it is. But it might happen that this link will not work anymore when you read this post.
Note: Use the PWA WebGL Template so that the application adjusts to the size of your browser window. Or adjust the settings in the generated index.html page:
“MQTT for Unity” is a Unity Package designed to seamlessly integrate MQTT (Message Queuing Telemetry Transport) functionality into Unity projects, offering a user-friendly solution for enabling real-time communication and data exchange within Unity applications.
Tested on Windows, OSX, WebGL, UWP + HoloLens2, and Android. iOS not tested, but should work as well.
Streamlined Integration: “MQTT for Unity” provides a straightforward and hassle-free integration process, enabling developers to quickly set up MQTT communication in their Unity projects.
Real-Time Communication: Harness the power of MQTT to establish real-time communication channels within your Unity application, perfect for multiplayer games, IoT applications, and more.
Customizable Configuration: Easily configure MQTT parameters, such as broker settings, topic subscriptions, and message handling, to tailor the communication to your specific project needs.
Cross-Platform Compatibility: “MQTT for Unity” is designed to work seamlessly across various Unity-supported platforms, including Windows, OSX, WebGL, UWP + HoloLens2, and Android. iOS not tested, but should work as well.
With “MQTT for Unity,” developers can unlock the potential of MQTT communication in their Unity applications without the complexities of manual integration, making it an essential tool for creating interactive and connected experiences in Unity.
The GraphQL for Unity Asset uses the Newtonsoft version which is built in newer version of Unity (2020+). If you get an error like this:
Assembly 'Library/ScriptAssemblies/Assembly-CSharp.dll' will not be loaded due to errors: Reference has errors 'GraphQL'.
Assembly 'Assets/GraphQL/Libs/GraphQL.dll' will not be loaded due to errors:
GraphQL references strong named Newtonsoft.Json Assembly references: 12.0.0.0 Found in project: 12.0.1.0.
Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
Then you can try to remove NewtonSoft dependency from your project – if you have a dependency. And just use the NewtonSoft version which is already built in and shipped with Unity 2020+. If you use an older version of Unity then you can try to copy the NewtonSoft DLL from 2020 and use this in your older Unity version.
Or you can go to Project Settings -> Player -> Other Settings and deactivate βAssembly Version Validationβ
Install the newtonsoft package from Unity. Go into the package manager and click “+” and then select “Add package from git URL” and fill in “com.unity.nuget.newtonsoft-json”.