Class GameSimManager
Namespace: Unity.Simulation.Games
Syntax
public class GameSimManager
Properties
Instance
Declaration
public static GameSimManager Instance { get; }
Property Value
| Type | Description |
|---|---|
| GameSimManager |
Methods
CaptureStepSeries(Int32, String)
Enable step series metrics for a list of counters captured at the specified cadence. The minimum interval is 15 seconds, if a smaller value is provided it will be increased to the minimum.
Declaration
public void CaptureStepSeries(int intervalSeconds, string counterName)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | intervalSeconds | The number of seconds between each snapshot. Must be 15 or more seconds. |
| String | counterName |
FetchConfig(Action<GameSimConfigResponse>)
Fetch the GameSim config for this instance.
Declaration
public void FetchConfig(Action<GameSimConfigResponse> configFetchCompleted)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<GameSimConfigResponse> | configFetchCompleted | When the fetch is completed, the action is called with a GameSimConfigResponse object that can be used to get GameSim values for the keys in the simulation. |
Get<T>(String, T)
Returns the value associated with the given key.
Declaration
public T Get<T>(string key, T defaultValue = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key | Name of the parameter to fetch |
| T | defaultValue | If not found, the value returned by this function. Defaults to the default value for the given type. |
Returns
| Type | Description |
|---|---|
| T | Value associated with the key |
Type Parameters
| Name | Description |
|---|---|
| T | Type of the parameter. At edit time you can infer this with GameSimEditorUtilities.TypeFor(string key). |
GetCounters(String, String, String)
Returns a list of counters in memory with metadata
Declaration
public string GetCounters(string instanceId, string attemptId = "", string gameSimSettings = "")
Parameters
| Type | Name | Description |
|---|---|---|
| String | instanceId | |
| String | attemptId | |
| String | gameSimSettings |
Returns
| Type | Description |
|---|---|
| String | CountersData |
GetKeys()
Returns a list of all keys for parameters in the game simulation environment
Declaration
public string[] GetKeys()
Returns
| Type | Description |
|---|---|
| String[] |
HasKey(String)
Returns whether or not the given key exists in the parameter configuration
Declaration
public bool HasKey(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| String | key |
Returns
| Type | Description |
|---|---|
| Boolean |
IncrementCounter(String, Int64)
Increment the counter with a certain number
Declaration
public void IncrementCounter(string name, long amount)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name of the counter to increment. |
| Int64 | amount | Amount by which to increment the counter. |
ResetCounter(String)
Resets the counter back to 0
Declaration
public void ResetCounter(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name of the counter |
SetCounter(String, Int64)
Sets the counter to the value passed in
Declaration
public void SetCounter(string name, long value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | Name of the counter to increment. |
| Int64 | value | Value to set the counter to. |
SnapshotCounters(String)
Snapshots the current values of all counters and labels them. Label will append a numeric value if it is not unique.
Declaration
public void SnapshotCounters(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| String | label | Label to tag counter values with |