using UnityEngine; using UnityEngine.XR.Interaction.Toolkit; public class ToggleMove : MonoBehaviour { void Update() { if (Input.GetKeyDown(KeyCode.M)) { if (GetComponent().enabled) { GetComponent().enabled = false; GetComponent().enabled = false; } else { GetComponent().enabled = true; GetComponent().enabled = true; } } } }