123456789101112131415161718192021 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class autoDisableGameObj : MonoBehaviour
- {
- public float disableTime = 5f;
- /// <summary>
- /// This function is called when the object becomes enabled and active.
- /// </summary>
- void OnEnable()
- {
- StartCoroutine(DisableIteself());
- }
- private IEnumerator DisableIteself()
- {
- yield return new WaitForSeconds(disableTime);
- gameObject.SetActive(false);
- }
- }
|