Settings

Settings is a dummy class that can be extended in any way to store user information. Every time the user minimizes app, this class is serialized and saved in JSON format. It is restored during next game session.

Code example in Buildbox:

// store the name of the selected character
Settings.selectedCharacter = this.entity().name();

// get the stored character name from Settings
let charName = Settings.selectedCharacter;

You can also see this code in action in the Variable Save and Variable Load nodes.

Variables set in the Settings class can be accessed and changed after export from within Xcode (iOS), Android Studio (Android), and Visual Studio 2017 (Windows). This can be useful for custom SDK integration, A/B testing, and more. Note: Windows Exe files cannot be edited post-export.

To access the Settings class in Android Studio, import PTPSettingsController. Then you can set variables with setSettingsValue(), continue on the above example: setSettingsValue(“selectedCharacter”, “‘Character1′”) or for an object variable, setSettingsValue(“myObjectVariable”, “{objectid: 123, myString:’my string here’}”).

To access the Settings class in Xcode or Visual Studio 2017, import BBRuntime/BBRuntimeShared.h and use getSettingsValue and setSettingsValue.

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?