|
I'm making a FPS game, but reloading won't work!I'm writing it with JavaScript Can anyone help?Code:
(comments are locked)
|
|
you cant have a yield in an update function. What you can do is use a while loop in your start function. please remember that you will get a much faster answer if you ask your question in a way that does not give people a hard time ot figure out what the problem is. I'm trying to wrap my head around this; does your first yield statement kick out to the Update(), run through one frame, then resume?
Jun 07 '11 at 08:42 PM
Chris D
my first while statement just makes sure that the start function loops. As you know Chris, Start only runs once just before the update function. so the while(true) which is always true will cause the while to loop all game long. Without a yield or some sort of delay, a while true in start will crash your game/editor but with a delay it works well. the second while tells it not to go on unless reloading is true, when reloading becomes true it will pass that line of code and start to reload. at the end reloading is set back to false so it will only run reload once till reloading is set back to true externally.
Jun 08 '11 at 12:03 AM
Anxowtf
OH MY GOD!Thank you, Thank you! It Works now :D Thanks again
Jun 08 '11 at 06:10 AM
Deelis
(comments are locked)
|

Rule #1 of Unity Answers: format your code so we can read it.
Yes! Format your code by highlighting the code an press the "10101" button. I already did this for you.
please edit your question to properly format the code. We will be happy to answer your question but please dont make us struggle to figure out whats going on.
Oh my god I'm sorry guys. T_T I'mma noob