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 kc01 · Mar 28, 2015 at 01:54 AM ·

Application.Loadlevel NOT WORKING!

My code:

 #pragma strict
  var LoadingSign : Texture2D;
  
  function Start()
  {
      Invoke("Loading", 2);
  }
  
  function Loading()
  {
      Debug.Log("The level should have loaded now.");
      Application.LoadLevel("1");
      }    
  function OnGUI(){
   theGUILoad();
  }
  
  function theGUILoad(){
   GUI.Label(Rect(450, 150, 400, 500), LoadingSign);
  }

There are no errors on this one, just not loading level, I even added the debug.log, and nothing still.

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
2

Answer by Bunny83 · Mar 28, 2015 at 02:03 AM

Is your level named "1"? If you ment using the level index you should use an integer value:

 Application.LoadLevel(1);

The string version of Application.LoadLevel expects the file name of the level. Example:

 Application.LoadLevel("MyLevelName");

Keep in mind that you can only load levels that are added in the build settings dialog.

Also note that the index starts at 0. So check your levels in your build settings dialog. The level index can be found at the far right of each level.

Comment
Add comment · Show 3 · 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 kc01 · Mar 28, 2015 at 02:16 AM 0
Share

Still not working! i exactly name the 1 with what my level is actually called, and it still did not work!

avatar image kc01 · Mar 28, 2015 at 02:17 AM 0
Share

and it is in the build settings

avatar image Bunny83 · Mar 28, 2015 at 02:20 AM 0
Share

Have you tried using the level index? You just say "it doesn't work". What exactly does work, what doesn't? Do you see the Debug.Log message?

If there's no Debug.Log message, your Loading method isn't called at all. Are you sure that script is attached to a script in the scene and the script is enabled? Also make sure the GameObject it's attached to is active. Also keep in $$anonymous$$d if you have set the Time.timeScale to "0" the two seconds will never complete.

avatar image
0

Answer by Captain-Awesome · Mar 28, 2015 at 04:05 AM

Bunny83's answer should have worked.

Did you add the level to load to your "scenes to build"? I don't think you can load levels unless they're in that list.

From the File menu, choose Build Settings. Then drag your level to the "Scenes to Build" list, and then try Application.LoadLevel(0);

Do that and it's guaranteed to load something. :)

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Crosshair changes to opposite colour when hovering over something 1 Answer

[mobile development] 2D Joystick Controller 0 Answers

Menu selection help 1 Answer

'ridgidbody2D' unexpected symbol? Help please. 1 Answer

Variable problem in Javascript. 3 Answers


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