TaiZhouCangChu_VRanime/Assets/动画/Scripts/ShowAfterDelay.cs

28 lines
453 B
C#

using UnityEngine;
public class ShowAfterDelay : MonoBehaviour
{
public GameObject objectToShow;
public float delayInSeconds = 2.0f;
private float timer = 0.0f;
private bool hasShown = false;
void Update()
{
if (!hasShown && timer >= delayInSeconds)
{
objectToShow.SetActive(true);
hasShown = true;
}
timer += Time.deltaTime;
}
}