BluetoothHolder.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class BluetoothHolder : MonoBehaviour
  6. {
  7. bool debug = true;
  8. public static BluetoothHolder ins;
  9. public static void Init()
  10. {
  11. if (!BluetoothHolder.ins) {
  12. GameObject bluetoothHolder = Resources.Load<GameObject>("Prefabs/BluetoothHolder");
  13. GameObject.Instantiate(bluetoothHolder);
  14. }
  15. }
  16. void Awake()
  17. {
  18. if (ins)
  19. {
  20. Destroy(this.gameObject);
  21. } else {
  22. ins = this;
  23. DontDestroyOnLoad(this.gameObject);
  24. }
  25. }
  26. void Start() {
  27. if (!debug) {
  28. this.transform.Find("CanvasForOpenDebug").gameObject.SetActive(false);
  29. }
  30. CloseDebug();
  31. }
  32. public void openDebug() {
  33. this.transform.Find("Canvas").gameObject.SetActive(true);
  34. this.transform.Find("Objects").gameObject.SetActive(true);
  35. }
  36. public void CloseDebug() {
  37. this.transform.Find("Canvas").gameObject.SetActive(false);
  38. this.transform.Find("Objects").gameObject.SetActive(false);
  39. }
  40. }