22 lines
499 B
C#
22 lines
499 B
C#
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);
|
|
}
|
|
}
|