Sign In Register

How can we help you today?

Start a new topic

Gamespark event with Untiy

i am very new to gamesparks and i want to use gamesparks as backend of my unity game. I have very unclear concepts on how to interact gamesparks event with unity. For example, i want to create a custom event in gamesparks that store user email in gamesparks database.

1.) i create a custom event in gamesparks(shortcode Email  type: string   use in script )

2.) create an email inputfield in unity and send the api request to gamespark 

new GameSparks.Api.Requests.LogEventRequest()


            .SetEventAttribute("Email", emailInputField.text)

            .Send((response) => {

                if (!response.HasErrors)


                    GSData gSData = response.ScriptData;

                    Debug.Log("gSData : " + gSData.JSON.ToString());




                    Debug.Log("Error Occur : " + response.Errors.JSON.ToString());



but the result is i always got gsData : {"Email" : null}

However i want the expected result is i can link the emailInputField.text to the custom event  for later i can send the email to user , How can i do this? many thanks

1 Comment


I would recommend working through our Getting Started Guides for Unity to which covers a lot of the basics you will need when working with GameSparks. The Cloud Code guide in particular should be helpful for your current issue. 

I wouldn't expect to see any 'Email' field in your response unless you are explicitly setting it in your event's cloud code. The contents of 'response.ScriptData' is determined by what fields you set in your event's script. For example, to just return the submitted email address you could use:

Spark.setScriptData("Email", Spark.getData().Email);



Login to post a comment