How Would I Load A Level From A Gui Button Press
I am currently in the midst of a School Assignment and i have some experience in coding but i cannot figure out how to load a level when a press of a gui button. Can Someone please help? Thanks
Comment
Answer by Jason2014 · Feb 24, 2016 at 01:47 PM
if (GUI.Button (new Rect (0, 0, 128, 32), "Load scene"))
{
Application.LoadLevel (scene_name);
}
BTW in Unity 5 Load level function is obsolete and then you should use SceneManager.LoadScene ("scene_name") instead.
Using this remember to import SceneManagement library.
using UnityEngine.SceneManagement; // (in C#)
import UnityEngine.SceneManagement; // (in JS)
I formatted and added links to your post, you should try it yourself next time. :)