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.