The namespace Unity.Simulation.Games gives you access to GameSimManager, the primary class that you’ll be interacting with. It will facilitate both fetching the config for the simulation and using counters to track metrics.
As of 0.2.0-preview and above Counters no longer have to be instantiated. If a counter with the specified key is not found, it will be created.
The following APIs are provided for interacting with Counters:
void IncrementCounter(string name, Int64 amount) - Increments the current value of the counter name by amount.void ResetCounter(string name) - Resets the value of a counter name to 0.void SetCounter(string name, Int64 amount) - Sets the value of a counter name to value.In 0.2.0-preview and above, the following APIs are provided for fetching the config for the simulation run:
void FetchConfig(Action<GameSimConfigResponse> configFetchCompleted)
GameSimConfigResponse is a struct with the following APIs for getting values after a config has been fetched. Each API will return the value for the key. If the key is not found, the defaultValue is returned:
int GetInt(string key, int defaultValue = 0)bool GetBool(string key, bool defaultValue = false)float GetFloat(string key, float defaultValue = 0f)long GetLong(string key, long defaultValue = 0l)string GetString(string key, string defaultValue = "")For more details, please see the implementation guide.
Last Updated May 5, 2020