Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 CCV334 · Sep 04, 2015 at 05:20 PM · buttoncontrollermenujoystickcursor

How do you make a Main Menu that only takes Joystick input and is not affected by the Cursor

I have setup a main menu using the Canvas UI, buttons and text based upon the Unity 5 tutorials: https://unity3d.com/learn/tutorials/topics/user-interface-ui

In the EventSystem I have set First Selected to the Play Button that I created. When the Menu begins the Play Button is selected allowing the player to navigate through the other buttons on the menu via the left stick on an Xbox controller. The problem is that if the player clicks on the game window using the mouse, but not on a button, then it makes the button currently highlighted no longer highlighted thus making navigation on the menu impossible with a controller.

I have tried hiding the cursor and locking it to the center but that does not prevent the mouse click from deselecting the button currently highlighted.

Is there a way to prevent the cursor from interfering with the joystick input or at least allow a button to stay highlighted despite clicking in the game window and not on a button?

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
0

Answer by Vice_Versa · Sep 04, 2015 at 09:05 PM

not sure if what youre trying to do is actually possible. generally, when i make a nonstandard interface, i dont use the GUI objects, i use regular GameObjects then code in everything myself for selection and hoveranimations.

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 CCV334 · Sep 05, 2015 at 03:46 AM 0
Share

Thank you Vice Versa for your quick reply. If there is no alternative method of going about doing this then I would love to hear your approach using GameObjects as buttons. Looking at this method I already see that I would need to somehow implement the following:

  • Pointer (keep track of what is currently highlighted)

  • An array of some sort (store all the other buttons)

  • Hovering state ("button" currently selected)

  • Normal state ("button" not selected)

  • Pressed state ("button" clicked)

I have had no experience in doing anything like this and would appreciate some tips or additional advice to send me towards the right direction.

if any alternative methods come up I would be more than grateful to hear them. thank you again for your time.

avatar image
0

Answer by CCV334 · Sep 05, 2015 at 08:07 AM

A current solution I have is the following:

  • Hide the cursor using Cursor.visible = false;

  • Create a completely transparent Panel in front of the canvas used to prevent the cursor with interfering with the buttons

  • Reload the scene if there is any mouse input:

       if (Input.GetMouseButtonDown(0))
         {
             Application.LoadLevel(Application.loadedLevel);
         }
         
         if (Input.GetMouseButtonDown(1))
         {
             Application.LoadLevel(Application.loadedLevel);
         }
         
         if (Input.GetMouseButtonDown(2))
         {
             Application.LoadLevel(Application.loadedLevel);
         }
    
    

I'm still open to suggestions but for now this will suffice.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

XBox Controller Joystick-Driven Mouse Cursor in Unity 0 Answers

Joystick buttons don't reset on application start 1 Answer

How to know if finger is on joystick if it is at horizontal & vertical zero 0 Answers

How to have multiple types of controller input using the input manager 0 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