Created
April 9, 2025 19:55
VRChat/GlobalSwitch.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UdonSharp; | |
using UnityEngine; | |
using VRC.SDKBase; | |
using VRC.Udon; | |
public class GlobalSwitch : UdonSharpBehaviour | |
{ | |
public GameObject[] targets; | |
[UdonSynced] | |
public bool targetsEnabled=false; | |
public override void Interact() | |
{ | |
Networking.SetOwner(Networking.LocalPlayer,gameObject); | |
targetsEnabled = !targetsEnabled; | |
} | |
public void Update() | |
{ | |
foreach (var target in targets) | |
{ | |
target.SetActive(targetEnabled); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment