- Home /
Script is not working at all
I had this "fixed" in another qustion, but the fix still didnt work and no one seems to be answering it anymore. so here is the script that i was given
if (Input.GetKeyDown(KeyCode.esc))
{
//Load Game
Application.LoadLevel("2");
}
Check the console for errors or warnings. Your question is not specific. If there is no level with the name "2", as a string, it will not load. If you're trying to load level 2, which is the index of the level, don't use the index as a string..
Application.LoadLevel(2);
Hit Ctrl + Alt + B to bring up build settings, make sure the level is added.
Well Ive tried both the levels real name and the level index as well and it still does not work, the level has been added i made sure of that, and no other scripts use that key or level.
sorry I cant test this for you I am writing this from the wiiU but you have to put "" inside the (). Try changing the key to something other than esc, also try using Input.Get$$anonymous$$ey("esc"), or try using a box trigger to load the level when ur characte enters it. These are all simple mistakes. I don't know whether you are a master coder, a beginner, or something in between so I hope I didn't offend you with stupid suggestions
Answer by superluigi · Aug 07, 2013 at 07:17 AM
function Update()
{
if(Input.GetKey("escape"))
{
Application.LoadLevel(2);
}
}
thank you alot! but in a straight line like that it is a bit confusing
so im sorry again, im just really confused :( what needs to be in update? just the script? and i cant change "Load" to Esc? or Tab?
that works guaranteed tested it and everything. If it's right please thumbs up and mark as correct, I've never had a correct answer before. Well I have I've just never gotten credit for it.
I had to change "2" to "Pause menu" but it works! thank you for helping smooches on the cheek
check it out I accidently had "2" thats wrong its just 2 no "" needed. "" is for a name of something but if its just a level# in the build settings just put the number inside the ().
Answer by bubzy · Aug 07, 2013 at 06:11 AM
KeyCode.Escape
it did not work either, i do appritiate the help though
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Contunuing from old scene 1 Answer
unknown identifer explosion problem 2 Answers