Class CustomEvent
Use this class to record Custom events that are specific to your game, without creating a specific sub-class of Event.
The CustomEvent class is provided as a low-effort way to migrate to the new RecordEvent(...) API from the dictionary-based approach used by prior versions of the Analytics SDK (the CustomData(...) API). CustomEvent instances can be treated as write-only dictionaries through collection initialization and the string indexer, meaning the code changes to migrate to the new API should be minimal.
For more information about custom events, see the documentation page: https://docs.unity.com/ugs/en-us/manual/analytics/manual/record-custom-events
Implements
Inherited Members
Namespace: Unity.Services.Analytics
Assembly: Unity.Services.Analytics.dll
Syntax
public class CustomEvent : Event, IEnumerable
Constructors
CustomEvent(string)
Declaration
public CustomEvent(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Properties
this[string]
Declaration
public object this[string key] { set; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | key |
Property Value
| Type | Description |
|---|---|
| object |
Methods
Add(string, object)
Adds the objet
Declaration
public void Add(string key, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The name of this parameter, as defined in the event schema. |
| object | value | The value to store for this parameter, of the type defined in the event schema. Only primitive values (string/int/bool/float) are acceptable. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if an unsupported type is given for the value. |
GetEnumerator()
Declaration
public IEnumerator GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator |