using SC.XR.Unity.Module_InputSystem; using UnityEngine; using UnityEngine.UI; using static BoundingBox; public class Patch_ModelController : AbstractController { [SerializeField] private BoundingBox boundingBox; [SerializeField] private ManipulationHandler manipulationHandler; void Start() { if (GetComponent() != null) { Destroy(manipulationHandler); } if (GetComponent() != null) { Destroy(boundingBox); } toggle = GameObject.Find("SetBtn/Canvas/Parent/EditorBtn/Toggle").GetComponent(); } private Toggle toggle; private void Update() { if(!toggle.isOn) { if(manipulationHandler!=null) Destroy(manipulationHandler); if (boundingBox != null) { Destroy(boundingBox); if (transform.Find("BoundingBox").gameObject != null) Destroy(transform.Find("BoundingBox").gameObject); } } else { if (manipulationHandler == null) { manipulationHandler = gameObject.AddComponent(); } if (boundingBox == null) { boundingBox = gameObject.AddComponent(); boundingBox.FlattenAxis = FlattenModeType.DoNotFlatten; boundingBox.ActiveHandle = HandleType.Rotation | HandleType.Scale; } } } }