Class UdonEventUtils
- Namespace
- JLChnToZ.VRC.Foundation
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
unityEventUnityEventBaseThe UnityEventBase to add the listener to.
targetMonoBehaviourThe MonoBehaviour instance to send events to when the listener is invoked.
eventNamestringThe 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
instanceMonoBehaviourThe 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
nullif 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.