Global Properties are used to configure the key parameters for your app that you want to be able to easily tweak server-side.
Creating a Global Property
Click the [+] plus icon at the upper-right corner of the list screen.
Enter the Name, Category, Type, and Description.
Property values can be simple strings or JSON objects. In either case, the data itself is stored as a String and left to the client to interpret.
The [Preserve value during deploy flag] is used to signal whether the value should be overwritten during deployment or not.
click the [Next] button and switch to the data input tab, put the data here for your new Global Property!
Design Suggestions
Global Properties that use a number range are generally the most useful in the long run. Text-based Global Properties tend to be less useful over time.
Agree with your developer in advance if your value will be a float, integer or boolean, or something more complex.
Group related variables together with Categories to make it easy to find the values later.
Designers should create brief descriptions that represent how changing the value changes the feel of the game.
Mention a good default and range in the Description.
โ
Writing the code
Now that you set up those global properties, you and your dev team will be able to use those variables in your app to tweak settings and gameplay.
In your client code
Add the brainCloud client to your app.
Pair the client with the dashboard.
Authenticate your user into brainCloud.
Request your Global Properties via ReadProperties API call.
Capture those properties, and pass them into your game's configuration.
void Start() {
// 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
_bc.ResetStoredAnonymousId();
_bc.ResetStoredProfileId();
_bc.AuthenticateAnonymous((response, cbObject) => { CustomAppSetup(); });
}
void CustomAppSetup() {
_bc.GlobalAppService.ReadProperties((response, cbObject) =>
{
var jsonMessage =
(Dictionary<string, object>) BrainCloud.JsonFx.Json.JsonReader.Deserialize(response);
var jsonData = (Dictionary<string, object>) jsonMessage["data"];
var PlayerHPCap = int.Parse(((Dictionary<string, object>) jsonData["PlayerHPCap"])["value"].ToString());
var turntime = int.Parse(((Dictionary<string, object>)jsonData["turntime"])["value"].ToString());
var EnergyStart = int.Parse(((Dictionary<string, object>)jsonData["EnergyStart"])["value"].ToString());
var MaxOnBoard = int.Parse(((Dictionary<string, object>)jsonData["MaxOnBoard"])["value"].ToString());
var PlayerHPStart = int.Parse(((Dictionary<string, object>)jsonData["PlayerHPCap"])["value"].ToString());
var DeckAllowNCopies = int.Parse(((Dictionary<string, object>)jsonData["DeckAllowNCopies"])["value"].ToString());
var deckSize = int.Parse(((Dictionary<string, object>)jsonData["deckSize"])["value"].ToString());
// TODO your custom setup logic for your game
setupCardGameConfigurations(PlayerHPCap, turntime, EnergyStart, MaxOnBoard, PlayerHPStart, DeckAllowNCopies, deckSize);
});
}