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 PuzzleBox · Dec 05, 2011 at 07:34 PM · loadmenuapplication.loadlevel

Loadlevel and buttons...

I've made a menu system that uses "Application.Loadlevel();" in order to load my scenes. When I go to build and play my game, the button I have set up to load the "Credits" works fine but the button that starts the first level doesn't work at all. What am I missing? Does the way the level is named important? What if you renamed a level after you add it to the "Scenes to build" window, will it still work properly?

My Code:

 var mySkin : GUISkin;
 
 
 
 function OnGUI () {
 
     GUI.skin = mySkin;
 
     
 
     GUI.Box(Rect(0, 0, Screen.width, Screen.height), "");
 
     if (GUI.Button (Rect (180,400,300,250), "Start")) {
 
         Application.Loadlevel("Level1");
 
     }
 
     if (GUI.Button (Rect (520,400,300,250), "Quit")) {
 
         Application.LoadLevel("Credits");
 
     }
 
 }
Comment
Add comment · Show 3
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 nastasache · Dec 05, 2011 at 10:44 PM 0
Share

Rena$$anonymous$$g a level it's not important (will appear automatically renamed in "Scenes to build" (containing, as better list to test in your case: 0 = "Level1"; 1 = "Credits"). - It's there any errors in debug window when you press Play to play "Level1" scene? - Which object have attached above script, and in which scene ("Level1" or "Credits")? As dannyskim said, your script looks good, but I think we need more details about how the script it's used.

avatar image PuzzleBox · Dec 05, 2011 at 11:36 PM 0
Share

I have my menu script on a GUITexture, and its in level zero

avatar image PuzzleBox · Dec 06, 2011 at 12:42 AM 0
Share

I went back and found this error: "$$anonymous$$issing$$anonymous$$ethodException: $$anonymous$$ethod not found: 'UnityEngine.Application.Loadlevel'.

2 Replies

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

Answer by GameGuy · Dec 06, 2011 at 01:15 AM

Your spelling is incorrect.

You wrote "Application.Loadlevel" , but it should be "Application.LoadLevel"

Edit: Look at the L in Level(Application.LoadLevel) it is lower case and should be upper case! :)

Comment
Add comment · 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
1

Answer by dannyskim · Dec 05, 2011 at 07:38 PM

Doesn't look like there is anything wrong with your code. Have you checked your Build Settings:

File => Build Settings...

and made sure that all your scenes are loaded into the 'Scenes to Build' window? Have you double checked your spelling, because as I'm sure you know passing strings inside of functions is explicitly case sensitive?

Comment
Add comment · Show 2 · 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 PuzzleBox · Dec 05, 2011 at 09:42 PM 0
Share

I have the level in the scene to build and the name is spelled the same way as in the script and it still doesn't work. I even tried loading the level by index.

avatar image GameGuy · Dec 08, 2011 at 01:07 PM 0
Share

I dont know why my answer is ignored, and yours is upvoted but the problem here is not File => Build Settings or anything else. It is a simple spelling mistake!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to add event to an object 1 Answer

How do you create a menu using C# in Unity? 1 Answer

Why wount my saving script save properly ? 0 Answers

IS it possible to load the whole game (and all scenes) at startup to avoid scene change delay? 1 Answer

How to use option setting Vibrate and Mute 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