Hello all. This may be a really simple solution, but i am having problems with spawning one instance of a prefab after the score of the game is 30 and am asking for. I would like that when the score hits 30, the prefab (level complete) is instantiated at vector2.zero, and that only one instance of that prefab is created.
function Update () {
if (score.gameScore >= 30 ){
Instantiate( levelBeat, Vector2.zero, Quaternion.identity);
}
}
This is the code that i am working on. I tried putting it into the Start function, but when the score hits 30 nothing happens, and in the Update function since it is called every frame, the level complete prefab is spawned every frame. Can someone help with this troublesome issue?