Table of Contents

Class UdonEventUtils

Utility methods for working with Udon behaviours and events.

public static class UdonEventUtils
Inheritance
UdonEventUtils
Inherited Members

Methods

AddUdonEventListener(UnityEventBase, MonoBehaviour, string)

Adds a listener to a UnityEventBase that sends an event to the specified MonoBehaviour instance when invoked.

public static void AddUdonEventListener(this UnityEventBase unityEvent, MonoBehaviour target, string eventName)

Parameters

unityEvent UnityEventBase

The UnityEventBase to add the listener to.

target MonoBehaviour

The MonoBehaviour instance to send events to when the listener is invoked.

eventName string

The name of the event to send to the instance when the listener is invoked.

Remarks

If target has a compatible method for sending events (either UdonBehaviour.SendCustomEvent or Component.SendMessage(string)), the listener will be added to the unityEvent to send the specified event to the instance when invoked.

GetSendEventAction(MonoBehaviour)

Gets a UnityAction<String> that can be used to send events to the specified MonoBehaviour instance.

public static UnityAction<string> GetSendEventAction(this MonoBehaviour instance)

Parameters

instance MonoBehaviour

The MonoBehaviour instance to get the send event action for.

Returns

UnityAction<string>

A UnityAction<String> that can be used to send events to the specified instance, or null if no compatible method is found.

Remarks

If the instance is an UdonBehaviour or an UdonSharpBehaviour, the returned action will use UdonBehaviour.SendCustomEvent to send events. Otherwise, it will use Component.SendMessage(string) to send events.