- Home /
Question by
kinggamer1235 · Mar 31, 2015 at 09:20 AM ·
c#application.loadlevel
Application.LoadLevel(); not working
Heres my script
using UnityEngine;
using System.Collections;
public class Start : MonoBehaviour {
// Update is called once per frame
void Update ()
{
if (Input.GetKey(KeyCode.Space))
{
Application.LoadLevel("Game");
}
}
}
I attached it to the Main Camera but when I press space nothing happens. I have gone into build settings and have added all the levels. I cant for the life in me figure out what I'm doing wrong, please help!
Comment
Answer by Digital-Phantom · Mar 31, 2015 at 09:22 AM
Firstly check that your spelling and capitalisation are both exactly the same for the level name.
Also, try Input.GetKeyDown instead of Input.GetKey
:)
Answer by kinggamer1235 · Mar 31, 2015 at 10:33 AM
It must have been a spelling error because when I created a we project and did it again it worked, thanks for the help
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Don't lose variable data when reloading a level - c# 3 Answers