Home Artists Posts Import Register

Content

Here 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);

            }

        }

    }

Comments

No comments found for this post.