docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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

    Inheritance
    object
    Event
    CustomEvent
    Implements
    IEnumerable
    Inherited Members
    Event.SetParameter(string, string)
    Event.SetParameter(string, bool)
    Event.SetParameter(string, int)
    Event.SetParameter(string, long)
    Event.SetParameter(string, float)
    Event.SetParameter(string, double)
    Event.Validate()
    Event.ParameterHasBeenSet(string)
    Event.Reset()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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

    Implements

    IEnumerable
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)