I have a problem
Here’s my code
using UnityEngine;
public class PlayerCollision_ : MonoBehaviour
{
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "obstacle")
{
Application.LoadLevel(0);
}
}
}
I wanna add a WaitForSeconds(1.5) before Application.LoadLevel(0)
Or like i wanna add a delay before the game restarts,
Good day.
Then use a IEnumerator method:
public class PlayerCollision_ : MonoBehaviour
{
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "obstacle")
{
StartCoroutine(LoadNewScene());
}
}
IEnumerator LoadNewScene()
{
yield return new WaitForSeconds(1.5f);
Application.LoadLevel(0);
}
}
Ps: Do not copy/paste and continue with your life… Try to find about all you dont know, try to learn, and try to use it again when you need it…
Good luck!
Bye!