docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class MessageAction<T1>

    A type-dispatching action map that routes an IMessage and one additional argument to a registered callback based on the message's MessageTypeId.

    Inheritance
    object
    MessageAction<T1>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.SimulationPro.Foundation
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    public class MessageAction<T1>
    Type Parameters
    Name Description
    T1

    The type of the additional argument passed to every callback.

    Methods

    Add(MessageTypeId, Action<IMessage, T1>)

    Registers a callback for messages with the given MessageTypeId.

    Declaration
    public void Add(MessageTypeId messageTypeId, Action<IMessage, T1> callback)
    Parameters
    Type Name Description
    MessageTypeId messageTypeId

    The message type ID to dispatch on.

    Action<IMessage, T1> callback

    The action to invoke with the message and the additional argument.

    Add<T>(Action<T, T1>)

    Registers a strongly-typed callback for messages of type T.

    Declaration
    public void Add<T>(Action<T, T1> callback) where T : IMessage
    Parameters
    Type Name Description
    Action<T, T1> callback

    The typed action to invoke when a message of type T is received.

    Type Parameters
    Name Description
    T

    The concrete IMessage type to handle.

    Invoke(IMessage, T1)

    Dispatches the message and additional argument to the registered callback.

    Declaration
    public void Invoke(IMessage msg, T1 arg1)
    Parameters
    Type Name Description
    IMessage msg

    The message to dispatch.

    T1 arg1

    The additional argument to pass to the callback.

    Exceptions
    Type Condition
    NotImplementedException

    Thrown if no callback is registered for the message type.

    In This Article
    Back to top
    Copyright © 2026 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)