This post has been wikified, any user with enough reputation can edit it.
Question by
Aidentiger · Dec 09, 2015 at 01:00 PM ·
c#guiloadlevel
How do I change scenes using a GUI button in unity 5.1
I would like to create a title screen for my current game and being new to c# and Unity in general I would like to change scenes after pressing on a button. If possible I would like this in C# rather than javascript or boolean. (P.S. I own a 4GB Macbook Air running El Capitan with a 1.4GHz i5 processor.)
Comment
Best Answer
Answer by Brokenarrow · Dec 09, 2015 at 01:50 PM
if (GUI.Button(new Rect(10, 10, 50, 50))
{
Application.LoadLevel("sceneName");
}
Put this in your OnGUI(). "sceneName" is the name of the scene you want to load.
Thanks for the help! It works great, but now that I have it for GUI do you know how to do it, but with collisions?(I'm trying to make a loading zone at the end of my level but can't get it to work for the life of me.)