How do I confirm Registration
This tutorial will cover how to check whether the Unity 3D Registration and login process was successful. This tutorial will not cover the concepts like Unity Events and other Unity related concepts. It is assumed that you already have knowledge of these concepts. You can find great information on the Unity 3D website.
Download the ctalyst Unity Plugin and install it into your project and ensure the RegistrationLoginMenu.unitypackage has been imported in you project. For this tutorial we will be using the ctalyst RegistrationOrLogin, Registration, and Login scenes provided in the ctalyst Unity Plugin.
The packages are available through your Disrupted Logic ctalyst account Publisher Dashboard > API, Token & Banking > APIs & Token.
For more information about how to import and use the RegistrationLoginMenu..unitypackage you can watch our tutorial “Setting Up A User Registration And Login System With Unity 3D And The Ctalyst Plugin”
Import the Plugin and Custom Scenes:
After importing the RegistrationLoginMenu.unitypackage custom package, you will have the following folder structure in you unity project window.
Check Registration Request Status:
Open RegistrationHelper.cs script under Assests/Scripts/ folder in you favorite text editor. Following code will confirm if the Registration is successful or not.
// Add custom method to execute when Registration is Successful ctalyst.ctalyst_Game_Registration.AddUserRegisterSuccessfulEventListener(RunOnRegistrationSuccessful); // Add custom method to execute when Registration is Successful ctalyst.ctalyst_Game_Registration.AddRegistrationErrorEventListener(RunOnRegistrationNotSuccessful);
The first Line of code adds an Event Listener that will execute the user defined method RunOnRegistrationSuccessful. You can put your custom code inside this method to notify the user. For example, you can display text on the screen that displays a confirmation message as shown in the image.
The second line of code adds an additional Event Listener that will execute the user defined method RunOnRegistrationNotSuccessful. This serves as a custom method that runs if the registration is not successful. You can use your custom code to display an Error Message to the user as shown in the image.
Check Login Request Status:
Open the Login.cs script under Assests/Scripts/ folder in you favorite text editor. The following code will confirm if the Login is successful or not.
// Add custom method to execute when Login is Successful ctalyst_Game_Registration.AddUserLoginSuccessfulEventListener(LoginSuccessful) // Add custom method to execute when Login is Successful ctalyst_Game_Registration.AddErrorEventListener(LoginNotSuccessful);
Similar to the Registration Menu, the Login Menu will also register two Unity Events that will be fired by ctalyst Unity Plugin with a successful login or a failed login as defined in the above code sample. LoginSuccessful and LoginNotSuccessful are methods that a developer can define to take appropriate action on each event respectively.
Below are two screen captures, in which login successful message and error message are shown.
You can use the code “as is”, or you can modify to suit your needs. We very much recommend offering your app or game users a valuable reward for registration and successful login. Our registration system helps ensure that your users are real people, they have opted in to receiving your email messages and thus keeping you CanSpam and Casl compliant, and allows you to post-market your titles, features, specials, in app store, and more.
This covers how to add confirmation to Registration and Login requests.