Hi Ameesha,
Glad to hear you’re interested in using GameSparks. I’ve gone through the tutorials myself and was able to authenticate and register in Unity. Would you be able to ensure the following are correct in your Unity scene:
Could you double check these and let me know if you are still having issues authenticating?
Regards,
Cillian.
Hello Cillian,
Thank you for the fast reply!
I seem to have everything as it is meant to be except I don't have the
"RegisterPlayer.RegisterBttn" Function
This is my "Authenticate Player" script;
using UnityEngine; using System.Collections; using UnityEngine.UI; public class AuthenticatePlayer : MonoBehaviour { public Text displayNameInput, userNameInput, passwordInput; public void AuthorizePlayerBttn() { Debug.Log("Authorizing Player..."); new GameSparks.Api.Requests.AuthenticationRequest() .SetUserName("userNameInput.text") .SetPassword("passwordInput.text") .Send((response) => { if (!response.HasErrors) { Debug.Log("Player Authenticated... \n User Name: " + response.DisplayName); } else { Debug.Log("Error Authenticating Player... \n " + response.Errors.JSON.ToString()); } }); } }
And my "Register Player" script;
using UnityEngine; using System.Collections; using UnityEngine.UI; public class RegisterPlayer : MonoBehaviour { public Text displayNameInput, userNameInput, passwordInput; public void RegisterPlayerBttn() { Debug.Log("Regestering Player..."); new GameSparks.Api.Requests.RegistrationRequest() .SetDisplayName (displayNameInput.text) .SetUserName (userNameInput.text) .SetPassword (passwordInput.text) .Send((response) => { if (!response.HasErrors) { Debug.Log("Player Register \n User Name " + response.DisplayName); } else { Debug.Log("Error Regestering Player... \n " + response.Errors.JSON.ToString()); } }); } }
And finally my Inputs;
Please let me know if there is anything else that you need, I'm wondering if maybe it's the names of my inputs?
Kind Regards,
Ameesha
Hi Ameesha,
Could you try dragging the entire RegisterPlayer_Canvas from the Hierarchy into the OnClick() of your button as shown below? The function dropdown should then populate and allow you to choose the RegisterPlayerBttn function from the RegisterPlayer script.
Let me know if that works for you!
Regards,
Cillian.
You're an absolute legend!
Thank you for taking time out of your day to help me! It's all working now and I am over the moon!
Thank you so much!
Until next time,
Ameesha
ameesha projects
Good evening!
I have been working on a game for a little over a month but have gotten stuck on connecting Gamesparks with my Unity game's login and register scene so I can't give access to other players.
I have looked high and low for about a week and haven't found anything, I did follow THIS, a lot of videos and written tutorials but unfortunately fell to a dead end each time.
I did already ask this question in one of the learn area comments and looked around the Q and A area but saw nothing had been made and/or hadn't been answered in 4 months, I am very apologetic if this gets repeated.
If you have any easy to follow tutorials I would be over the moon to see them!