• 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
Question by Satamanster · Jul 11, 2012 at 10:08 AM · guibuttonbugmouse

2 Bugs in my game: mouse control takes some time to load and Menu not working.

Ok people once again i surrender to your knowledge. Here's my question. I'm having two bugs happening inside my game.

It's a tank game and the first question is related to the tank control. So i have a script to make it move wich is applied to the general object. I have then two sub-scripts that control his tower and his cannon. They are as simple as this....


 var verticalSpeed : float = 2.0;
 function Update () {
     //Mouse delta (não varia entre -1 e 1)
     var v : float = verticalSpeed * Input.GetAxis ("Mouse X");
     //Debug.Log(Input.GetAxis("Mouse X"));
     transform.Rotate (0, 0, v);
 }



The horizontal one is the same. The problem with this script, and i don't know why, when i start the game i can control the overall tank but this mouse control takes like 5 seconds or more to be loaded and get me control over my cannon. Why is this happening? is something related to unity's loading script order memory or so?

The other bug that i have in my game here is related to the menu. I have this script over two buttons in my main menu, the buttons are simply a 3d text with a box collider applied to them.


 var levelToLoad : String;
 var soundhover : AudioClip;
 var beep : AudioClip;
 var QuitButton : boolean = false;
 function OnMouseEnter(){
 audio.PlayOneShot(soundhover);
 }
 function OnMouseUp(){
 audio.PlayOneShot(beep);
 yield new WaitForSeconds(0.35);
 if(QuitButton){
 Application.Quit();
 }
 else{
 Application.LoadLevel(levelToLoad);
 }
 }
 @script RequireComponent(AudioSource)



And in my main menu i have this script that is assessed by a script to check the esc button:


 var menuHeight:float=500;
 var menuWidth:float=500;
 var buttonSpacing:float=25;
 var mainMenu: String = "MainMenu";
 var titleTexture:Texture2D;
 var customSkin:GUISkin;
 var customStyle:GUIStyle;
 
 function OnGUI(){
 GUI.skin = customSkin;
 GUILayout.BeginArea(Rect(Screen.width/2-menuWidth/2,Screen.height/2-menuHeight/2,menuHeight,menuWidth),customStyle);
 GUILayout.Space(50);
 GUILayout.Label(titleTexture);
 GUILayout.Space(buttonSpacing);
 if(GUILayout.Button("Main Menu")){
 Application.LoadLevel(mainMenu);
 }
 GUILayout.Space(buttonSpacing);
 if(GUILayout.Button("Exit to Desktop")){
 Application.Quit();
 }
 GUILayout.Space(buttonSpacing);
 GUILayout.EndArea();
 }



The problem here is that if i play my game from the beginning there is no problem pressing the play menu button and start the game or pressing quit to exit app, but once i use the pause menu to go back to the main menu these two buttons (play game and quit) don't work anymore... Is this a unity's bug or am i missing something?

Thanks a lot guys, hope you can help me solve this problem. I'll be glad to hear from you. :D

Comment

People who like this

0 Show 0
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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to detect if mouse over a button 2 Answers

Turn off my GUI Box when I click a button. 3 Answers

Weird bug: tapping on any GUI button leads to another 3D button handler execution 0 Answers

GUI Button to a GUI slider help ? 0 Answers

Null reference exception[SOLVED] 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