MakeEneutralButton.cs 770 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MakeEneutralButton : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. public Material initM;
  8. public Material clickM;
  9. public GameObject suerClickGameObj;
  10. private void Start()
  11. {
  12. suerClickGameObj = this.transform.parent.transform.Find("CheckBoxCheck").gameObject;
  13. }
  14. public void SetUserClickThis(bool isClick)
  15. {
  16. if (isClick)
  17. {
  18. this.GetComponent<MeshRenderer>().material = clickM;
  19. suerClickGameObj.SetActive(true);
  20. }
  21. else
  22. {
  23. this.GetComponent<MeshRenderer>().material = initM;
  24. suerClickGameObj.SetActive(false);
  25. }
  26. }
  27. }