Sign In Register

How can we help you today?

Start a new topic

How to log gamesparks cloudcode message to unity?

Hello guys! i am new to gamesparks, i want to ask how to log gamespark cloudcode message in unity console. For example in AuthenticationRequest :

var userPassword = Spark.getData().password;

how can i log this result in unity console just like unity c# Debug.Log("message");

many thx 

1 Comment

Hi Fan,

To send data to the client you can send the data as scriptData with the request and retrieve it in the response via the client.

For example:

//cloud code

//set the key and value


Then in Unity you can retrieve the scriptData value using the relevant GETTER for the data type.e.g string, number, list, JSON object etc.

//Unity code

GSData scriptData = response.ScriptData;//get the script data
 Debug.Log("password "  + scriptData.GetString("Password"));//get the script data that is a type of string and has the key Password

For more information on how to send data to Unity you can go here. It is also probably a bad idea to send the password to the client so I would not recommend doing this. But this example gives you the general idea how to do it though for future data you need to send.



2 people like this
Login to post a comment