TargetView.cs 623 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class TargetView : MonoBehaviour
  6. {
  7. void Start()
  8. {
  9. Show(false);
  10. this.transform.Find("Button").GetComponent<Button>().onClick.AddListener(delegate() {
  11. Show(true);
  12. });
  13. this.transform.Find("RawImage").GetComponent<Button>().onClick.AddListener(delegate() {
  14. Show(false);
  15. });
  16. }
  17. void Show(bool value)
  18. {
  19. this.GetComponent<RawImage>().enabled = value;
  20. this.transform.Find("RawImage").gameObject.SetActive(value);
  21. }
  22. }