- Home /
Game works great, then i build and run, it no longer works.
I use
if(GameObject.Find("Enemy Mech") == 0) { Application.LoadLevel(3); }
Which seems to work when I run the game in unity.. But when I Build & Run, then use the .exe it created the function appears to not be working anymore.
I have tried reimporting everything, still nothing.
Uhm, dont know what else to say, like I said it all works in unity till i make it its own game. Please help!
When my bullet collides with the $$anonymous$$ech Enemy it pushes them into a deleter wall that destroys any object that touches it. So when both mechs hit the wall it should == 0 and provide me with the Win Screen (Application.LoadLevel(3); but it just kills the two mechs and nothing happens.
HI Stimmerr,
Couple of things:
Have you tried loading the level using it's name rather than index?
Have you added a print("Trying to load level"); just before the Application.LoadLevel(3); just to see if you are actually getting to that part of the code?
Try this: if(GameObject.Find("Enemy $$anonymous$$ech") == null)
Answer by Stimmerr · Dec 03, 2012 at 06:29 PM
Tried both, and found that it wasnt picking up on the == 0. Switched it to == null and that fixed the problem.
Also changed it to the level name rather than index.
thanks guys!
Great news. It's always nice to give those of us who helped a click on the thumbs up in our comments ;)