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 Lvned · Feb 22, 2014 at 12:33 AM · buttonmenuworkmaindont

2D Game: main menu button dont work

Hello, this is my first question.

I have 3 scenes: - main - level_selection - level_001

In the scene "main" I have one texture (arcade) with a box collider. When I click on it, the scene "level_selection" appear.

In the scene "level_selection" I have another texture (level image) with a box collider, and when I click on it, the scene "level_001" appear.

Now, in the scene "level_001", I have two textures with one box collider on each. One is the texture for a "exit" button and the other is the texture for a "main menu" button.

When I click on the "exit" button, it close the app, and when I click on the "main menu" button, the scene "main" appear.

I use this codes:


GoMainMenu.js

function OnMouseDown () { Application.LoadLevel("level_001"); }


GoLevel1.js

function OnMouseDown () { Application.LoadLevel("main"); }


GoLevelSelection.js

function OnMouseDown () { Application.LoadLevel("level_selection"); }


This is the problem, I do this steps:

  1. In "main" I click on Arcade (go to level_selection).

  2. In "level_selection" I click on the level image (go to level_001).

  3. In "level_001" I click on the main menu button (go to main).

  4. In "main" I click on Arcade (go to level_selection).

  5. In "level_selection" I click on the level image (go to level_001).

  6. In "level_001" I click on the main menu button and the button dont work, nothing happen.

I dont know why. Anybody can help me? Im starting using unity about 2 days and i dont know a lot of things.

Sorry if my english is not good, I speak spanish.

Thank you.

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 Nanobrain · Feb 22, 2014 at 01:24 AM 0
Share

You're english is good enough :) Could you please post your code? That way, we might be able to see what you're doing wrong.

avatar image Lvned · Feb 22, 2014 at 04:55 AM 0
Share

Thank you for answer. Id post the code of the js im using on the buttons. You think is something wrong on the scripts id use in "level_001" scene?

I have 3 scripts with an instatiate creating objects in random positions.


Creator1.js

var egg : GameObject;

InvokeRepeating("Drop", 2, 6);

function Drop() {

var position : Vector3 = Vector3( -5, Random.Range(1.2, 2.3), 0);

Instantiate(egg, position, Quaternion.identity);

}


And I use other script to destroy the objects when them collide with another called "nest" and "terrain".


Destroy.js

function OnCollisionEnter2D(coll: Collision2D) {

 if (coll.gameObject.tag == "nest")
     
     Destroy(gameObject);
     
 if (coll.gameObject.tag == "terrain")
     
     Destroy(gameObject);
             

}


And i use other script to move my character


PlayerControl.js

var moveLeft : $$anonymous$$eyCode; var moveRight : $$anonymous$$eyCode; var moveUp : $$anonymous$$eyCode; var speed : float = 10; var jump : float = 0; var jumpSpeed : float = 5; var jumpTimer : float = 0;

function Update () { if (jump == 1){ jumpTimer = jumpTimer +1 ; if (jumpTimer >= 50){ jumpTimer = 0; jump = 0;}} if (Input.Get$$anonymous$$ey(moveLeft)){ rigidbody2D.velocity.x = speed -1; } else if (Input.Get$$anonymous$$ey(moveRight)){ rigidbody2D.velocity.x = speed; } else { rigidbody2D.velocity.x = speed 0; } if (Input.Get$$anonymous$$eyDown (moveUp)){ if (jump == 0){ rigidbody2D.velocity.y = jumpSpeed; jump = 1;}} }


Do you see something wrong impacting on the main button?

I have other button on my "level_001" scene to close the app:


Exit.js

function On$$anonymous$$ouseDown () { Application.Quit(); }


this button doesnt work neither when the main button dont work.

Thank you for your help.

avatar image Jamora Lvned · Feb 22, 2014 at 04:55 AM 0
Share

You should edit your original question to provide this new information ins$$anonymous$$d of posting an answer. Answers are for solutions only.

Do also remember to format your code using the 101010 button above the text box.

0 Replies

· Add your reply
  • Sort: 

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

20 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 avatar image avatar image avatar image

Related Questions

gui text button dont work 1 Answer

how to make a button work on main menu? 0 Answers

Sliding sub-menu from behind an icon 0 Answers

How to Change Menu Button Rollover States with GameObjects 1 Answer

Close GUI help. 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