VUdon - Events [](https://github.com/Varneon/VUdon-Events/stargazers) [](https://github.com/Varneon/VUdon-Events/releases) [](https://github.com/Varneon/VUdon-Events/releases/latest)
March 6, 2024 ยท View on GitHub
:warning: VUdon Events is heavily experimental and may break without a notice! Use at your own risk.
VUdon - Events

VUdon Events ("UdonEvents") allows you to nearly natively implement UnityEvents into UdonSharp.
How to use VUdon Events
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDKBase;
namespace Varneon.VUdon.UdonEvents
{
public class UdonEventTest : UdonSharpBehaviour
{
// Declare a serialized hidden field for the event handler singleton
[SerializeField, HideInInspector]
private UdonEventHandler udonEventHandler;
// Declare a serialized DataList field for each UdonEvent
[SerializeField, UdonEvent]
private DataList onPlayerTriggerEntered;
// Add UdonEventAttribute to the DataList fields for overriding
// the property drawer with the UdonEvent drawer
[SerializeField, UdonEvent]
private DataList onPlayerTriggerExited;
public override void OnPlayerTriggerEnter(VRCPlayerApi player)
{
// Invoke the UdonEvent's persistent calls stored in the DataList field
udonEventHandler.Invoke(onPlayerTriggerEntered);
}
public override void OnPlayerTriggerExit(VRCPlayerApi player)
{
// UdonEventHandler can invoke a list of calls by providing it the DataList
udonEventHandler.Invoke(onPlayerTriggerExited);
}
}
}
:package: UdonSharp scripts in a UPM package will need an assembly definition reference to
Varneon.VUdon.Events.Runtime
Installation
Import from Unitypackage:
- Download latest
com.varneon.vudon.events.unitypackagefrom here- Import the downloaded .unitypackage into your Unity project