Standard Login method
Note: This flow is not zero friction flow.
Step 1 – Adding GG Prefabs into Game Scene
- To use the standard login method using gamergraph, do the following:
- Go to Assets-> Gamergraph -> Prefabs -> GG_Essentials and drag and drop GG_Core and GG_Login_Signup into your hierarchy.
Step 2 – Setting up a Login Canvas
Next, set up a canvas with 2 input fields for:
And, add a button to canvas so that when pressed, the user logs in, as shown below
Step 3 – Assign Login Button to GG Prefab
- Next, expand the GG_Login_Signup prefab, and select the first child object.
- Assign the login button you created in the script section.
Step 4 – Assign Input Fields to GG Prefab
Next, select the second child object and assign the 2 input fields in the login section.
That’s it! You have successfully setup the standard login method!
Step 5 – Login callbacks to handle actions
*Callbacks, if implemented, are called automatically. All you have to do is put the code inside callbacks.
After logging a user in, you would want to perform some tasks. Those tasks may include, but not limited to:
- Changing scenes
- Perform other game related tasks.
All this can be accomplished using the login callbacks provided by gamergraph.
To implement login callback:
- Create a C# script, and open it in any code editor.
- Instead of monobehaviour, extend the script form GamerGraph_Plugin.GamerGraph_Callbacks.GG_LoginSignupCallbacks
- Implement the following callbacks for login as shown below.
- Attach this script to any gameobject in your scene!
Callback explanation: (Login)
- The first callback is the Pre login callback. Anything you want to do before login event happens, put its code inside this callback.
- The second callback is the Post login callback. Put the implementation code of all the instructions that must happen after login inside this callback.
- The third callback is the failed login callback. If a login fails, the code that handles it must be placed inside this callback.
Note: Since zero friction flow does not require any types of credentials, you can still implement these same callbacks for login in a zero-friction flow scenario and handle things as the same.