Search Results for

    Show / Hide Table of Contents

    Receiving Messages

    Receivers are UnityActions which are added to Messages. They are invoked whenever the Message is sent. This way you can create gameplay logic that reacts to certain Messages.

    Receivers should be removed when they are no longer needed, or when the owning Receiver object is destroyed. Not doing so can cause problems with garbage collection or Null Reference Exceptions.

    Tip

    Oftentimes it is good practice to add a Receiver during OnEnable and remove it during OnDisable.

    Tip

    The same Receiver can only be added once to the same MessageType, so you don’t have to worry about duplicate registration.

    Tip

    Anonymous methods will not be displayed correctly as Receiver in Editor tools like Overview Window and Info Window. Use regular methods instead.

    In This Article
    Back to top Malte HusungLeave a ReviewLegal Noticethank you ❤️