|
Hi, i'm a bloody newbie using unity3, but advanced in 3d. currently I'm working on a kind of an art-fps-game for a performance on stage. i need to change the levels manually at a certain time, so my first idea was to use keys switching to the levels, i.e. key #2 for level 2, key #3 for level 3 and so on... i have no idea how to solve this? glad for any suggestions: andreas
(comments are locked)
|
|
Hi, You could use something along those lines, using F2 and F3 keys: wow, thanks for that quick reply. i think i understand your codesnippet. thanks. last stupid question: where do i have to put that code to? :)
Jul 27 '10 at 03:15 PM
ama
put that in a script attached to a permanent element of your scene. Or you can as well create an empty GameObject, rename it "levelChange" for example and add the script with this inside (it's Javascript). That should do the trick for you. Be sure to have that "levelChange" GameObject in all your scenes :)
Jul 27 '10 at 03:26 PM
Thaelvyn
You missed a few semi colons, you need : Application.Loadlevel("level2");
Jul 27 '10 at 04:19 PM
Fishman92
hi there, thank u very much for your help. so i entered this code onto an empty GameObject: function Update(){ If (Input.GetKey(KeyCode.F2));{Application.Loadlevel("level2");} else if (Input.GetKey(KeyCode.F3)){ Application.Loadlevel("level3");} else if (Input.GetKey(KeyCode.F4)){ Application.Loadlevel("level4");} else if (Input.GetKey(KeyCode.F5)){ Application.Loadlevel("level5");} } but what I get is this error: Assets/NewBehaviourScript.js(3,63): BCE0044: expecting :, found ';'. what's wrong there? i think i almost got it, grr :)
Jul 27 '10 at 10:06 PM
ama
I typed a bit too fast, and without spellchecking :/. The first "If" statement has an uppercase I, it should be "if". That's the only error I can see there, but bare in mind that I am just waking up :)
Jul 28 '10 at 04:14 AM
Thaelvyn
(comments are locked)
|
