GraphQL on Unity and Result Event for Data and Errors…

The GraphQL for Unity Asset can be used to execute GraphQL queries in Unity. The result is set on properties of Unity objects and there is also a Unity Event on the GraphQL Query Object where user-defined function of a GameObject can be triggered every time when a queries returns data or an error.

public class Sample1 : MonoBehaviour
    public void ResultEvent(GraphQLResult result)
        if (result.Errors.Count==0)
            Debug.Log("Data: " + result.Data.ToString());
            Debug.Log("Error: " + result.Errors.ToString());

Create a GameObject with this class as component and then you can drag and drop this GameObject to the Query GameObject and select the “ResultEvent” method. Every time when the query is executed then this function will be called with the result data (or error data).

GraphQL on Unity & Newtonsoft Reference Error

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: Found in project:

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”.

Dockerfile for Python 3.9 with OpenCV, MediaPipe, TensorFlow Lite and Coral Edge TPU


FROM python:3.9-slim
RUN apt-get update && apt -y install curl gnupg libgl1-mesa-glx libglib2.0-0 && rm -rf /var/lib/apt/lists/*
RUN echo "deb coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list 
RUN curl | apt-key add - && apt-get update && apt-get install -y python3-tflite-runtime && rm -rf /var/lib/apt/lists/*
COPY requirements.txt /
RUN pip install -r /requirements.txt
COPY * /app/



Execute a GraphQL Query in Unity with C# Code

With GraphQL for Unity you can execute GraphQL Queries in a Unity way with GameObjects. But with the asset you can also execute queries in Unity with C# code.

Here is a simple example:

public GraphQL Connection;

public void ScriptQuery()
        var query = "query($Token: String!) { doit($Token) { result } } ";
        var args = new JObject
            { "Token", "123" }
        Connection.ExecuteQuery(query, args, (result) =>

Link the Connection variable to your GraphQL GameObject where the connection is set.

Note: the result callback function is called asynchronous and it is not executed in the Game-loop.

Industrial Data in the Graph Database Neo4j…

The Frankenstein Automation Gateway now also supports to write OPC UA values to the graph database Neo4j.

At startup it can also write the OPC UA node structure into the graph database, so that the basic model of the OPC UA server is mirrored to the graph database. For that you have to add the “Schemas” section in the config file (see an example configuration file below). There you can choose which RootNodes (and all sub nodes) of your OPC UA systems should be mirrored to the graph database.

Once you have the (simplified) OPC UA information model in the graph database, you can add on top of that your own knowledge graph data and create relations to OPC UA nodes of your machines to enrich the semantic data of the OPC UA model.

With that model you can leverage the power of your Knowledge Graphs in combination with live data from your machines and use Cypher queries to get the knowledge out of the graph.

Here we see an example of the OPC UA server from the SCADA System WinCC Open Architecture. The first level of nodes below the “Objects” node represent Datapoint-Types (e.g. PUMP1) followed by the Datapoint-Instances (e.g.: PumpNr) and below that we see the datapoint elements (e.g. value => speed). An datapoint element is an OPC UA variable where we also see the current value from the SCADA system.

Example Gateway configuration file:

    - Id: neo4j
      Enabled: true
      Type: Neo4j
      Url: bolt://nuc1.rocworks.local:7687
      Username: "neo4j"
      Password: "manager"
        - System: opc1  # Replicate node structure to the graph database
            - "ns=2;s=Demo"  # This node and everything below this node
        - System: winccoa1  # Replicate the nodes starting from "i=85" (Objects) node
        BlockSize: 1000
        - Topic: opc/opc1/path/Objects/Demo/SimulationMass/SimulationMass_Float/+
        - Topic: opc/opc1/path/Objects/Demo/SimulationMass/SimulationMass_Double/+
        - Topic: opc/opc1/path/Objects/Demo/SimulationMass/SimulationMass_Int16/+
        - Topic: opc/winccoa1/path/Objects/PUMP1/#
        - Topic: opc/winccoa1/path/Objects/ExampleDP_Int/#

Docker CPU Limits…

If your docker container do not use all your cpu’s, it may be the case that limits are set in /etc/systemd/system/docker.slice. To apply changed settings I had to reboot my machine (just a restart of docker didn’t change the behaviour).

cat /etc/systemd/system/docker.slice 

Description=Docker Systemd Slice


Niryo with Unity3D and the Automation Gateway…

The Digital Twin is Alive 🙂 #Unity3D, the #Niryo Robot, and the Automation Gateway #Frankenstein with #GraphQL for #PLC4X …

#ModBus data from the Robot can now be used in #Unity for visualisation and also to control the Robot from Unity …

The Unity Package GraphQL for OPCUA is now not only for OPCUA anymore, it can also handle other types which are supported by the Automation Gateway – like the Plc option, which is based on PLC4X.

Display OPC UA data via GraphQL in a HTML page …

Here is a simple HTML page which fetches data from the OPC UA Automation Gateway “Frankenstein”. It uses HTTP and simple GraphQL queries to fetch the data from the Automation Gateway and display it with Google Gauges. It is very simple and it is periodically polling the data. GraphQL can also handle subscription, but then you need to setup a Websocket connection.

   <script type="text/javascript" src=""></script>
   <script type="text/javascript">
      google.charts.load('current', {'packages':['gauge']});

      var data = null
      var options = null
      var chart = null

      function drawChart() {

        data = google.visualization.arrayToDataTable([
          ['Label', 'Value'],
          ['Tank 1', 0],
          ['Tank 2', 0],
          ['Tank 3', 0],

        options = {
          width: 1000, height: 400,
          redFrom: 90, redTo: 100,
          yellowFrom: 75, yellowTo: 90,
          minorTicks: 5

        chart = new google.visualization.Gauge(document.getElementById('chart_div'));

        chart.draw(data, options);

      function refresh() {
        const request = new XMLHttpRequest();
        const url ='http://localhost:4000/graphql';"POST", url, true);
        request.setRequestHeader("Content-Type", "application/json");
        request_data = {
            "query": `{ 
              Systems {
                unified1 {
                  HmiRuntime {
                    HMI_RT_5 {
                      Tags {
                        Tank1_Level { Value { Value } }
                        Tank2_Level { Value { Value } }
                        Tank3_Level { Value { Value } }                          

        request.onreadystatechange = function() {
          if (this.readyState==4 /* DONE */ && this.status==200) {
            const result = JSON.parse(request.responseText).data
            const x = result.Systems      
            data.setValue(0, 1, x.unified1.HmiRuntime.HMI_RT_5.Tags.Tank1_Level.Value.Value);
            data.setValue(1, 1, x.unified1.HmiRuntime.HMI_RT_5.Tags.Tank2_Level.Value.Value);
            data.setValue(2, 1, x.unified1.HmiRuntime.HMI_RT_5.Tags.Tank3_Level.Value.Value);
            chart.draw(data, options);

      setInterval(refresh, 250)

    <div id="chart_div" style="width: 400px; height: 120px;"></div>
    <!--<button name="refresh" onclick="refresh()">Refresh</button>-->