New answers tagged

-1

[DMGregory Rightly said but additionally] As you said you are loading the new scene then, you should not need to destroy the gameobject. If you are willing pause the game then, i will recommend you timeScale When timeScale is set to zero the game is basically paused if all your functions are frame rate independent. Your should look like this void ...


3

You are destroying the GameObject on which this script is running as soon as it collides with an enemy. (Destroy (gameObject);) That means it can't wait 3 seconds before loading the next scene - in 3 seconds' time, it will no longer exist and so it can't run any scripts at all! You'll want to either delay the object's destruction until after the delay, or ...


0

I suggest you use Invoke. It's pretty simple, and the documentation is pretty clear, too. http://docs.unity3d.com/ScriptReference/MonoBehaviour.Invoke.html



Top 50 recent answers are included