*

Unity Authentication Example

This example shows how to use several of the authentication types in brainCloud. Specifically we illustrate how to authenticate using the following authentication types:

  • Email and password
  • Universal
  • Anonymous

Prerequisites

In order the get started you will need Unity installed. Please download the example project below here:

Unity Authentication Example Download

You can download the stand-alone brainCloud Unity library here:

brainCloud Unity Client

Running the project

To try out the example project you should just need to:

  • Unzip the project
  • Open the project in Unity
  • Open the Connect scene in the “Scenes” folder
  • Follow the steps in Pointing To Your Own Game below
  • Hit the play button

You should now see a screen like the following:

Connect_unity_-_BrainCloudExample_Unity_-_PC__Mac___Linux_Standalone

 

Feel free to try out the various authentication types. Note that email/password authentication will send you a validation email if it’s a new account being created. You will not be prevented from logging in right away however.

 

Pointing to your own game

In order to test out the authentication methods against your own brainCloud game follow these steps:

1) First, open the brainCloud Settings menu option:

brainCloud Settings menu

 

2) Next, modify the Game Id and Game Secret to point to your own game:

Connect_unity_-_BrainCloudExample_Unity_-_PC__Mac___Linux_Standalone-2

 

3) Ensure that the correct platform has been enabled in the brainCloud Portal Versioning page (under Design | Versioning):

brainCloud_Dashboard_-_Simple_Example

 

4) Import the game data from the “ImportData” folder.

See Import/Export Game Data in the portal tutorial section for more info.

You should be all good to go!

 

Further Reading

You can find more information on the Authentication methods by visiting this section of the API reference:

Authentication APIs

The code within the example project that deals with authentication is located in “Scripts/ConnectScene.cs”.