- Home /
Question by
Mrroundtree22 · Oct 14, 2017 at 06:51 PM ·
playerissueloadlevel
Scene switching not working?
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneSwitch : MonoBehaviour {
public void SceneSwitcher ()
{
if (Input.GetKeyDown(KeyCode.V))
{
Debug.Log("Scene2 loading: ");
Application.LoadLevel ("Scene2");
}
}
}
Nothing seem to be happening. I've watched several tutorials and read the manual and they all say the same thing but it still doesn't work.
Comment
Best Answer
Answer by Dragate · Oct 14, 2017 at 06:56 PM
How is SceneSwitcher() called? If it doesn't get called by anywhere, the code in it won't be executed. Try replace "SceneSwitcher" with "Update". Update() gets called once per frame.
Answer by InvictusCo · Oct 15, 2017 at 09:13 PM
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneSwitch : MonoBehaviour {
public void Update ()
{
if (Input.GetKeyDown(KeyCode.V))
{
Debug.Log("Scene2 loading: ");
Application.LoadLevel ("Scene2");
}
}
}
Your answer
Follow this Question
Related Questions
Smooth Crouch Movement Issue 0 Answers
create an object at loadlevel 2 Answers
help loading level after destroying objects 1 Answer
Don'tDetroyOnLoad | issue 1 Answer
Next LEVEL Load Problem. 2 Answers