Hi Alex,
I'd recommend having a look at our Unity Getting started Guide. Particularly the Authentication example. It should cover your needs here. If you have any further questions after that just let us know.
Regards,
Liam
public class FD_Gamesparksmanager : MonoBehaviour { private static FD_Gamesparksmanager instance = null; void Awake() { if (instance == null) // check to see if the instance has a reference { instance = this; // if not, give it a reference to this class... DontDestroyOnLoad(this.gameObject); // and make this object persistent as we load new scenes } else // if we already have a reference then remove the extra manager from the scene { Destroy(this.gameObject); } } // Use this for initialization void Start() { authenticate(); } void authenticate() { new GameSparks.Api.Requests.DeviceAuthenticationRequest() .SetDisplayName("Randy2") .Send((response) => { if (!response.HasErrors) { Debug.Log("Device Authenticated...");// } else { Debug.Log("Error Authenticating Device..."); } }); } }
public class FD_Gamesparksmanager : MonoBehaviour { private static FD_Gamesparksmanager instance = null; void Awake() { if (instance == null) // check to see if the instance has a reference { instance = this; // if not, give it a reference to this class... DontDestroyOnLoad(this.gameObject); // and make this object persistent as we load new scenes } else // if we already have a reference then remove the extra manager from the scene { Destroy(this.gameObject); } } // Use this for initialization void Start() { authenticate(); } void authenticate() { new GameSparks.Api.Requests.DeviceAuthenticationRequest() .SetDisplayName("Randy2") .Send((response) => { if (!response.HasErrors) { Debug.Log("Device Authenticated...");// } else { Debug.Log("Error Authenticating Device..."); } }); } }
Still getting this error:
NullReferenceException: Object reference not set to an instance of an object GameSparks.Api.Requests.DeviceAuthenticationRequest..ctor () FD_Gamesparksmanager.authenticate () (at Assets/FD_Gamesparksmanager.cs:44) FD_Gamesparksmanager.Start () (at Assets/FD_Gamesparksmanager.cs:28)
When using the registrationrequest from the example, everything works fine!
Axel Dabee
Hi,
its a bit unclear on how to use the DeviceAuthorizationRequest.
I'm using the following Coding in Start()
However, I'm getting the following error message, marking the line "new DeviceAuthenticationRequest()"
What am I doing wrong?