Sign In Register

How can we help you today?

Start a new topic

Unity - MatchmakingRequest() - response.ScriptData is null


So I'm using Unity and the Test Harness to match make. However, I'm having trouble getting any data to come from the 'response.ScriptData' in Unity. Ideally I want to get the matchID. Perhaps I'm doing this incorrectly?

new MatchmakingRequest()



.Send((response) =>


    if (response.HasErrors)


            Debug.Log("MATCHMAKING - ERROR");




            GSData scriptData = response.ScriptData;



I use the above and it's a success (both on Test Harness and in Unity) but 'response.ScriptData' is null...

The Test Harness displays the 'MatchFoundMessage' and all the data in the inspector.

Worth noting the Unity client is registered/authenticated etc.

Has anyone seen this or know what I'm doing wrong?


Hi Chris,

You won't be able to retrieve a matchId here because the match won't exist yet when the response is sent back, it doesn't wait for matchmaking to take place before returning. Match creation will however result in a MatchFoundMessage being sent out to all players involved; you'd need to add a listener for this message to your client and retrieve your matchId there.

The reason your response's scriptData is returning null is because the MatchMakingResponse scriptData won't exist by default; unless you're calling Spark.setScriptData(key, value) somewhere in your MatchMakingResponse script, this value will be null.

If you have any further questions please let us know.



Hi Vinnie, can you elaborate on how to add listeners in Unity? I'm having trouble finding instructions for that in the documentation. Thanks!

Login to post a comment