- Home /
My object don't spawn as expected so what should I do?
var timeToWait : float = 2; private var timer : float = 0; var beginSpawn : boolean = false; var prefab : Transform; // My object expecting to spawn but it's not. private var spawnPoint : Vector3; var SpawnPoint: Transform;// where I want my object to spawn.
// I copied from karl but it's not working and it kept silent and not instantiate the object I expected so how should I go from here please HELP. Update(){ while(cur2Health <= 0){ if(beginSpawn==true) { spawnPoint = this.transform.position; timer += 1*Time.deltaTime; if(timer >= timeToWait)
{ Instantiate (prefab, spawnPoint, this.transform.rotation);
Destroy(gameObject); // This ensures that the instantiation only occurs once
}
}
}
}
Hi all Unities please help me. O ye this is just fragment of my whole code body even though no compilation error but it just not spawning as expected timer.
I think you should try to understand the script yourself before asking for help with it. You could start to ask yourself why is there a loop while cur2Health is less or equal to zero .. and what is this cur2Health anyway.
At this moment a bit too lonely just ask some question to break rope. Your answer could be nice if you made it an answered I could + 1 point for you. Thanks anyway I could fixing that problems anyway.
Your answer
Follow this Question
Related Questions
Respawn Management 2 Answers
Best way to respawn car? 0 Answers
How to delay a respawn? 1 Answer
enemy respawn after amount of time 2 Answers