Autologin

When a user is logged in to id.net and opens a game that uses the id.net SDK, they will logged in automatically. To do this, call Autologin once in the first scene’s Start() method. The autologin call should happen just after initializing the SDK. Note that the autologin feature only works in a browser and not in the Unity editor.

Autologin Example

Idnet.I.AutoLogin((user, autoLoginException) => {
 if (autoLoginException != null)
 {
#if UNITY_EDITOR
    Debug.Log("Autologin does not work in the Unity Editor,try it browser!");
#else
  // Callback: Autologin failed
    Debug.Log("Autologin failed,probably user not logged-in to https://www.id.net"); 
#endif
 }
 else
 {
    if (Idnet.User.LoggedIn())
    {
       // Callback: Autologin successfull
       Debug.Log("Auto login success. " + "Nickname " + Idnet.User.Current.Nickname);
    }
 }
});

Login Menu

login preview

Login Menu Example

Idnet.I.Login(loginRegisterException => {
 if (Idnet.User.LoggedIn())
 {
    // Callback: Login succesfull.
    Debug.Log("User logged in: " + "Nickname " + Idnet.User.Current.Nickname);
 }
});

Getting User Data

if(Idnet.User.LoggedIn())
{
   Debug.Log("Welcome: " + Idnet.User.Current.Nickname);
}
else
{
   Debug.Log("Not logged-in to IDnet" );
}

Registration Menu

register preview

Register Menu Example

Idnet.I.Register(loginRegisterException => {
 if (Idnet.User.LoggedIn())
 {
    // Callback: Login succesfull.
    Debug.Log("User logged in: " + "Nickname " + Idnet.User.Current.Nickname);
 }
});

Logout

Logout buttons are not needed as users can logout from id.net. If you need to logout for testing, use the following example.

	Idnet.I.Logout ();