Patch_ModelController.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using Blue;
  3. using SC.XR.Unity.Module_InputSystem;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class Patch_ModelController : AbstractController
  7. {
  8. [SerializeField] private ManipulationHandler manipulationHandler;
  9. void Start()
  10. {
  11. if (GetComponent<ManipulationHandler>() != null)
  12. {
  13. Destroy(manipulationHandler);
  14. }
  15. toggle = GameObject.Find("SetBtn/Canvas/Parent/EditorBtn/Toggle").GetComponent<Toggle>();
  16. }
  17. private Toggle toggle;
  18. private void Update()
  19. {
  20. if(!toggle.isOn)
  21. {
  22. if(manipulationHandler!=null)
  23. Destroy(manipulationHandler);
  24. }
  25. else
  26. {
  27. if (manipulationHandler == null)
  28. {
  29. manipulationHandler = gameObject.AddComponent<ManipulationHandler>();
  30. if(manipulationHandler.enabled==false)
  31. {
  32. manipulationHandler.enabled = true;
  33. }
  34. }
  35. }
  36. }
  37. }