Mirror Toggle
An example of setting up a mirror toggle via UI Button
Add a VRC Mirror prefab, disable it to save performance by default
Add a
Universal Actionto the Mirror objectMake sure
Activeis checked, checkFire Object Toggles, click on theGame Objects Listand clickAdd ElementDrag your Mirror object into the empty field, select
Togglein the dropdown on the right

Add a
UI -> Buttonto your scene, set theRender ModetoWorld Spaceand scale it way down and place it where you wantAdd a
Ui Shapecomponent to the CanvasChange canvas layer to
DefaultClick on your Button inside the Canvas and add a new
On Click()event by clicking the small+icon in the bottom rightDrag and Drop your Mirror object into the empty field that appeared
In the dropdown next to
Runtime OnlyselectUdonBehaviour -> SendCustomEvent(its all the way at the bottom)Type
Triggerin the text field

You're done! Now you can toggle your mirror via UI button in Udon.
The major thing to note here is to make sure that the component, and the game object its on, is always enabled if you're using the Delay parameter, otherwise it will never fire as the Update method will never be called.
Last updated