Answers for "Delayed respawn timer"

C#
0

Delayed respawn timer

public class DemoBehaviour : MonoBehaviour {
    public GameObject otherGameObject;
 
    public void Foo() {
        StartCoroutine(TemporarilyDeactivate(20));
    }
 
    private IEnumerator TemporarilyDeactivate(float duration) {
        otherGameObject.SetActive(false);
        yield return new WaitForSeconds(duration);
        otherGameObject.SetActive(true);
    }
}
Posted by: Guest on January-19-2022

C# Answers by Framework

Browse Popular Code Answers by Language