docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Event

    The Event class is a write-only container designed for you to safely and efficiently pass event data into the Analytics SDK for batching and upload to the back-end.

    Each of the Standard events can be recorded using the sub-classes provided. Custom events can be recorded either by creating specific sub-classes of Event or using the more generic CustomEvent class provided.

    For more information about creating and recording Custom events, see the documentation page: https://docs.unity.com/ugs/en-us/manual/analytics/manual/record-custom-events

    Inheritance
    object
    Event
    AcquisitionSourceEvent
    AdImpressionEvent
    CustomEvent
    TransactionEvent
    Inherited Members
    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 abstract class Event

    Constructors

    Event(string)

    Declaration
    protected Event(string name)
    Parameters
    Type Name Description
    string name

    Methods

    ParameterHasBeenSet(string)

    Use this when implementing the Validate method to determine if a required parameter has been set or not.

    Declaration
    protected bool ParameterHasBeenSet(string name)
    Parameters
    Type Name Description
    string name

    The name of the parameter

    Returns
    Type Description
    bool

    True if the parameter has been set, otherwise false

    Reset()

    Clears all parameters and values so that the instance can be reused.

    Declaration
    public virtual void Reset()

    SetParameter(string, bool)

    Sets a Boolean value for the given parameter name.

    Declaration
    protected void SetParameter(string name, bool value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    bool value

    The value to store for this parameter.

    SetParameter(string, double)

    Sets a float value for the given parameter name.

    Declaration
    protected void SetParameter(string name, double value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    double value

    The value to store for this parameter.

    SetParameter(string, int)

    Sets an integer value for the given parameter name.

    Declaration
    protected void SetParameter(string name, int value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    int value

    The value to store for this parameter.

    SetParameter(string, long)

    Sets an integer value for the given parameter name.

    Declaration
    protected void SetParameter(string name, long value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    long value

    The value to store for this parameter.

    SetParameter(string, float)

    Sets a float value for the given parameter name.

    Declaration
    protected void SetParameter(string name, float value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    float value

    The value to store for this parameter.

    SetParameter(string, string)

    Sets a string value for the given parameter name.

    Declaration
    protected void SetParameter(string name, string value)
    Parameters
    Type Name Description
    string name

    The name of this parameter, as defined in the event schema.

    string value

    The value to store for this parameter.

    Validate()

    Note that failing validation will not prevent event serialisation or upload. This method is intended to produce warning logs to assist in implementation and debugging. Events will still be validated properly by the server on reaching it.

    Declaration
    public virtual void Validate()
    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)