Sign In Register

How can we help you today?

Start a new topic

How to do user password recovery in Unity?

hello gamesparks. i know there have a tutorial that teach people how to do password recovery in gamesparks cloud code and i setup the cloud code already , but how can i fire the request from unity to gamesparks.i have already made a button that send request to gamesparks.

  new GameSparks.Api.Requests.AuthenticationRequest()

                .SetScriptData(???)   <--- this is what i want to ask 

                .Send((response) => {


                    if (!response.HasErrors)


                        Debug.Log("Attempt Password Recovery");




                        Debug.Log("Error Occur");




many thx for my silly question

1 Comment

Hi Fan,

I have answered this question in your support ticket but in case other people have this issue too I will post how to do it here too. You need to pass a GSRequestData object into the scriptData which can be the JSON you need. For example in the tutorial you need to add in { "email":"your email","action":"passwordRecoveryRequest"} JSON into the scriptData for the purpose of the tutorial. If you are unsure how to create a JSON object in Unity,here is a tutorial from the Unity docs on how to do it JSON Unity.

In Unity set up your object with the attributes you need for the request in this case action and email. Then you can create the object and serialize it to JSON. Then you can parse the JSON string as a GSRequestData and pass the data into the SetScriptData function. I have provided an example below which will better illustrate this process.



1 person likes this
Login to post a comment