Generation

generate functionSun, 13 Nov 2022

Make spawn object disappear and show for a while

public void MakeDisappearAndDie(GameObject spawnObject) { spawnObject.SetActive(false); //Destroy(spawnObject); StartCoroutine(WaitAndDestroy(spawnObject)); } IEnumerator WaitAndDestroy(GameObject spawnObject) { yield return new WaitForSeconds(2); Destroy(spawnObject); }

Questions about programming?Chat with your personal AI assistant