C# API Reference (Unity)
All APIs are static methods of the Gamebench
class in the GamebenchLib.Runtime
namespace. You do not need to instantiate anything.
If you want to start and stop sessions using these APIs remember to disable automatic capture via the option in the GameBench configuration panel in the Unity Editor.
Sessions
void SessionStart(string sessionTitle = null)
Starts a new capture session, with an optional title.
string GetSessionId()
Returns the UUID of the active session, or null if there isn’t one.
void SessionStop()
Stops the current capture session.
void Reset()
Deletes all GameBench data in the app. Must be called without an active session.
void Upload(UploadCallback callback = null)
Uploads any outstanding sessions to the endpoint configured in the UI. After successful upload the session data will be removed from the device. Must be called without an active session.
NB: The signature of the optional callback is delegate void UploadCallback(boolean success, string errorMessage)
and can run multiple times, as it will be called with the result of each individual session upload attempt.
Markers
To isolate specific areas of gameplay such as levels or battles, GameBench provides markers functionality. For example, to isolate performance data during a particular game level, you can call MarkerStart()
when the level begins and MarkerStop()
when the level is completed.
void MarkerStart(string name, string group = null)
Record a ‘start’ marker with the given name and marker group (optional).
void MarkerStop(string name, string group = null)
Record a ‘stop’ marker with the given name.
void MarkLaunchComplete()
Record a ’launch complete’ marker that has special significance in the web dashboard.
NB: Markers for Unity scene changes are recorded automatically by default.
Tags
void SetTag(string name, string value)
Set a tag in the tags collection
RemoveTag(string)
Remove a tag from the tags collection
Configuration
void SetConfigItem(string name, string value)
void SetConfigItem(string name, int value)
void SetConfigItem(string name, bool value)
See the Configuration section for the list of configurable items.
Note that values set with these APIs are transient and do not persist beyond process exit.