using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class GlobalSchema : MonoBehaviour { public List globalObjects; // Start is called before the first frame update private void OnEnable() { StartCoroutine(global()); } private IEnumerator global() { while (true) { yield return new WaitForSeconds(120f); foreach (GameObject obj in globalObjects) { obj.SetActive(!obj.activeSelf); } } } // Update is called once per frame void Update() { } }