U# Interact toggle script
Added 2021-09-21 18:24:59 +0000 UTCHere is a super simple script on how to toggle the state of an object in Unity via Udonsharp U# to be Active or Inactive (Visible or not)
Create a new U# script
Name it something so you can remember it easily.
Open up the script in your editor and then paste this as a public class:
public class InteractToggle : UdonSharpBehaviour
{
public GameObject[] toggleObjects;
public override void Interact()
{
foreach (GameObject toggleObject in toggleObjects)
{
toggleObject.SetActive(!toggleObject.activeSelf);
}
}
}