docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class FuncToMessage<T1>

    A type-dispatching function map that produces an IMessage from one input argument, routing to a registered factory based on a MessageTypeId.

    Inheritance
    object
    FuncToMessage<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 FuncToMessage<T1>
    Type Parameters
    Name Description
    T1

    The type of the input argument used to create the message.

    Methods

    Add(MessageTypeId, Func<T1, IMessage>)

    Registers a factory function for the given MessageTypeId.

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

    The message type ID to associate the factory with.

    Func<T1, IMessage> callback

    The function that produces an IMessage from the argument.

    Invoke(MessageTypeId, T1)

    Invokes the registered factory for the given MessageTypeId.

    Declaration
    public IMessage Invoke(MessageTypeId messageTypeId, T1 arg1)
    Parameters
    Type Name Description
    MessageTypeId messageTypeId

    The message type ID identifying the factory to invoke.

    T1 arg1

    The argument to pass to the factory function.

    Returns
    Type Description
    IMessage

    The produced IMessage.

    Exceptions
    Type Condition
    NotImplementedException

    Thrown if no factory is registered for the given type ID.

    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)