Skip to main content
Version: 5.7.0

BrainCloudWrapper

The BrainCloudWrapper class provides an easier way for developers to handle user authentication when they are getting started with the authentication system. This includes persisting authentication data between application runs.

By using the wrapper authentication methods, the anonymous and profile IDs will be automatically persisted upon successful authentication. When authenticating, any stored anonymous/profile IDs will be sent to the server. This strategy is useful when using Anonymous authentication.

tip

Note - you should initialize the wrapper before using it. It will in turn initialize the brainCloud client for you - don't do both!

Method Parameters

ParameterDescription
wrapperNameDistincts saved wrapper data. Use when using more than one instance of brainCloud

Usage

http://localhost:3000
// Unity

//Note: Ensure of have selected your app using the brainCloud Unity Plugin

using UnityEngine;

public class BCConfig : MonoBehaviour {

private BrainCloudWrapper _bc;

public BrainCloudWrapper Get()
{
return _bc;
}

void Awake ()
{
DontDestroyOnLoad(gameObject);
_bc = gameObject.AddComponent<BrainCloudWrapper>();

_bc.WrapperName = gameObject.name; // Optional: Set a wrapper name
_bc.Init(); // Init data is taken from the brainCloud Unity Plugin
}
}


// C#
_bc = new BrainCloudWrapper("_mainWrapper");