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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Paradox_01 · Feb 09, 2015 at 11:07 AM · 2dapplication.loadlevel

Application.LoadLevel wrong loading of Level

I want to make a level menu that connects all my scenes.

Here is my code (it is in JAVASCRIPT):

function OnMouseUp(){

 if(GameObject.FindWithTag("A")){
     Application.LoadLevel("Letter A");
 }
 else if(GameObject.FindWithTag("B")){
     Application.LoadLevel("Letter B");
 }
 else if(GameObject.FindWithTag("C")){
     Application.LoadLevel("Letter C");
 }
     

}

so, the problems is when I click A and B it is fine but when I click the scenes from a will appear. I also tried to use the index but it is much worse. when I used the index, when i click A and B scene from letter C will load. What seems to be the problem?

Comment
Add comment · Show 4
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 meat5000 ♦ · Feb 08, 2015 at 11:37 PM 0
Share

Did you add them to the scene list in the Build Settings?

avatar image Paradox_01 · Feb 09, 2015 at 08:41 AM 0
Share

Yes I already did its working but wrong level loading

avatar image Bonfire-Boy · Feb 09, 2015 at 11:14 AM 0
Share

The action performed appears to be deter$$anonymous$$ed by what objects can be found in the scene, rather than by what object you have clicked on. Is that what is intended? As things stand, if there is an object with the tag "A" in the scene, it will always load the scene "Letter A".

It's not at all clear to me what you mean by "when I used the index". What index? Used it how?

avatar image Paradox_01 · Feb 09, 2015 at 12:53 PM 0
Share

index number from the build sir. Application.LoadLevel(); have 2 parameters right? it can be string and int/index I used both of them but same result

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Joyrider · Feb 09, 2015 at 11:08 AM

Your scene has objects with all 3 tags in the scene?

Because right now you are basically loading scene A if an object with Tag A is present, same for B, same for C. So in the end... the last scene loaded is scene linked to C obviously.

You're not checking for any click recipient.

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 Paradox_01 · Feb 09, 2015 at 12:51 PM 0
Share

Can you help me improve my code? I tried everything I know Im just new to unity sorry

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

Assets/Scripts/PlayerController.cs(32,49): error CS0126: An object of a type convertible to `float' is required for the return statement 1 Answer

2D Animation does not start 1 Answer

Application.LoadLevel (Roguelike 2D) 2 Answers

Can I add some 3D in a 2D project? 1 Answer

2D platformer- getting errors I don't understand (c#) 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