mmorpg2d/Assets/Script/autoDisableGameObj.cs
2025-06-07 23:53:54 +05:30

22 lines
520 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);
}
}