ShowHideSelfOnPointerClick.cs 490 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. namespace ARLocation.Utils
  3. {
  4. public class ShowHideSelfOnPointerClick : MonoBehaviour
  5. {
  6. private Canvas canvas;
  7. // Use this for initialization
  8. void Start()
  9. {
  10. canvas = GetComponent<Canvas>();
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. if (Input.GetMouseButtonDown(0))
  16. {
  17. canvas.enabled = !canvas.enabled;
  18. }
  19. }
  20. }
  21. }