Answer the question
In order to leave comments, you need to log in
Do not spawn object after restart what to do?
After the restart button, the object stops spawning here is the code
using System.Collections;
using UnityEngine;
public class SpownBombs : MonoBehaviour
{
public GameObject bomb;
void Start ()
{
StartCoroutine (Spawn ());
}
IEnumerator Spawn ()
{
while (!Player.lose)
{
Instantiate (bomb, new Vector2 (Random.Range (-2.5f, 2.5f), 5.9f), Quaternion.identity);
yield return new WaitForSeconds (1.2f);
}
}
}
Answer the question
In order to leave comments, you need to log in
You probably have Player.lose does not change after reloading the scene.
I decided everything instead of Player.lose set true and everything worked
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question