Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by TonyDanzaa · Oct 31, 2013 at 09:26 AM · guiscenemenuloadingstart

Start menu gui wont load scene

Hi Guys,

I am really new to Unity3D Free. I have used a load GUI script from Unity's free 'Lerpz Escapes' tutorial and adapted it slightly for my scene. The loading scene comes up nicely with an image i made and the buttons.

When i press 'Start', 'Loading...' pops up, however it doesn't load the scene. I am sure it is some tiny thing i have done incorrectly, but does someone please have an answer for this?

'L4NLevel1' is my scene i want to load, i tryed putting it in the same folder as the 'StartMenuGUI' scene but that doesnt work either.

Code:

 #pragma strict
 // Make the script also execute in edit mode
 @script ExecuteInEditMode()
 var gSkin : GUISkin;
 var backdrop : Texture2D; // our backdrop image goes in here.
 private var isLoading = false; // if true, we'll display the "Loading..." message.
 
 function OnGUI()
 {
     if (gSkin)
         GUI.skin = gSkin;
     else
         Debug.Log("StartMenuGUI: GUI Skin object missing!");
         
     var backgroundStyle : GUIStyle = new GUIStyle();
     backgroundStyle.normal.background = backdrop;
     GUI.Label ( Rect( (Screen.width - (Screen.height * 2)) * 0.75, 0, Screen.height * 2,Screen.height), "", backgroundStyle);
     //GUI.Label ( Rect( (Screen.width/2)-197, 50, 400, 100), "LEFT4NED","mainMenuTitle");
     
     if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play"))
     {
         isLoading = true;
         Application.LoadLevel("L4NLevel1"); // load the game level.
     }
     
     
     var isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
     Application.platform == RuntimePlatform.WindowsWebPlayer);
     
     if (!isWebPlayer)
     {
         if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 80, 140, 70), "Quit"))
         Application.Quit();
     }
 
     if (isLoading)
         GUI.Label ( Rect( (Screen.width/2)-110, (Screen.height / 2) - 60, 400, 70),"Loading...", "Loading...");
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by EvilWarren · Oct 31, 2013 at 09:54 AM

Add your scene to File->Build Settings... Scenes In Build.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TonyDanzaa · Oct 31, 2013 at 10:45 AM 0
Share

Awesome! Thanks, i knew it was something simple like this.

avatar image
0

Answer by The_Magical_Kiwi · Oct 31, 2013 at 09:49 AM

Are you sure "L4NLevel1" is correct and capilised exactly in that way?

Best thing to do if you are just starting out and trying to debug a piece of code is to use the Debug.Log() method to print stuff to the console.

Try

 if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height - 160, 140, 70), "Play"))
 {
    Debug.Log("I've pressed the button");
    isLoading = true;
    Application.LoadLevel("L4NLevel1"); // load the game level.
 }

That way you'll know you are definitely accessing the block of code which loads the level.

Apart from that it is difficult to suggest answers without more detail.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TonyDanzaa · Oct 31, 2013 at 10:43 AM 0
Share

Thanks for the debug tip, its always useful, and i did see that that particular bit of code was running. I simply didn't add it to the build settings.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Display multiple scenes? 1 Answer

Scene starts before scene loading is finished 0 Answers

[SOLVED]Static Loading screen help 0 Answers

Why do I have to click GUI Menu twice to start in Web player? 0 Answers

What Happens in Scene Load 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges