Unity Set Active For Seconds

[Solved] Unity Set Active For Seconds | Csharp - Code Explorer | yomemimo.com
Question : unity set active for seconds

Answered by : zarden

public class ActivatorObject : MonoBehaviour { public GameObject objectToActivate; private void Start() { StartCoroutine(ActivationRoutine()); } private IEnumerator ActivationRoutine() { //Wait for 14 secs. yield return new WaitForSeconds(14); //Turn My game object that is set to false(off) to True(on). objectToActivate.SetActive(true); //Turn the Game Oject back off after 1 sec. yield return new WaitForSeconds(1); //Game object will turn off objectToActivate.SetActive(false); } }

Source : | Last Update : Mon, 25 Apr 22

Answers related to unity set active for seconds

Code Explorer Popular Question For Csharp