AutoAwakeOpenOrClose.cs 353 B

123456789101112131415161718192021
  1. using System;
  2. using UnityEngine;
  3. namespace BasicTools
  4. {
  5. public class AutoAwakeOpenOrClose : MonoBehaviour
  6. {
  7. private void Awake()
  8. {
  9. for (int i = 0; i < this.objs.Length; i++)
  10. {
  11. GameObject gameObject = this.objs[i];
  12. gameObject.SetActive(this.open);
  13. }
  14. }
  15. public bool open;
  16. public GameObject[] objs;
  17. }
  18. }