Initialize
Method initializes both BrainCloudWrapper
and BrainCloudClient
.
The parameters for this method vary by client (for example the Unity client takes none at all, as all data is pulled from the brainCloud editor menu data).
Method Parameters
Parameter | Description |
---|---|
serverURL | The URL to the brainCloud server |
secretKey | The secret key for your app |
appId | The app ID |
version | The app version |
companyName | Client dependent - The company name used in the keychain for storing anonymous and profile IDs. You are free to pick anything you want. |
appName | Client dependent - The app name used in the keychain for storing anonymous and profile IDs. You are free to pick anything you want. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Unity
GameObject go = new GameObject();
_bc = go.AddComponent<BrainCloudWrapper>();
_bc.WrapperName = _wrapperName; // optionally set a wrapper-name
_bc.Init(); // extra data, such as: _appId, _secret and _appVersion, is taken from the brainCloud Unity Plugin.
DontDestroyOnLoad(go); // keep the brainCloud game object through scene changes
// C#
string serverUrl = "https://api.braincloudservers.com/dispatcherv2";
string secret = "1234-1234-1234-1234";
string appId = "123456";
string version = "1.0.0";
_bc.Init(serverUrl, secret, appId, version);
const char* serverUrl = "https://api.braincloudservers.com/dispatcherv2";
const char* secret = "1234-1234-1234-1234";
const char* appId = "123456";
const char* version = "1.0.0";
const char* company = "bitHeads";
const char* appName = "Awesome Game";
_bc->initialize(serverUrl, secret, appId, version, company, appName);
NSString* serverUrl = @"https://api.braincloudservers.com/dispatcherv2";
NSString* secret = @"1234-1234-1234-1234";
NSString* appId = @"123456";
NSString* appId = @"1.0.0";
NSString* company = @"bitHeads";
NSString* appName = @"Awesome Game";
[_bc initialize:serverUrl
secretKey:secret
appId:appId
version:version
companyName:company
appName:appName];
private BrainCloudWrapper _bc;
//Initialize BrainCloudWrapper
_bc = new BrainCloudWrapper("default");
//After that, initialize your app with appId, app secret and app version
_bc.initialize("12832", "d03c0bf7-e00c-4179-b477-37e90bc54df9", "1.0.0");
secret = "1234-1234-1234-1234";
appId = "123456";
_bc.initialize(appId, secret, "1.0.0");
secret = "1234-1234-1234-1234";
appId = "123456";
_bc.init(secretKey: secret,appId: appId,version: "1.0.0",updateTick: 50));
note
If updateTick is greater than 0
a built-in run loop timer is started and updates every updateTick ms . For application that already have a run loop, set to 0
and make to call udpate() from within your run loop.
// N/A
// N/A
JSON Response