Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
11 Jun 22 - 14 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
6
Question by MicDaRoc · Jul 21, 2015 at 10:43 AM · buttoncanvasmenueventsystemselect

First selected GameObject not highlighted

Hi! I'm having some issues concerning my pause menu. My pause menu consists of a Canvas with 3 Buttons (Resume, Exit to Main Menu, Exit Game). I want the buttons to be controllable by Gamepad. To begin with I just want the Menu to work fine with keyboard and later after I figured everything out I'll "convert" it to solo-gamepad-controls. In the Event System I dragged my Resume Button into "First Selected". This seemed to work. The problem is, that the button isn't highlighted. I know that the Resume Button is selected, because on pausing the game, the game continues after pressing Enter. I have to select the other buttons first (with the arrow keys up and down) to be able to highlight the different selected buttons. Does anyone know how to select AND highlight my first selected button?

Thanks in advance!

Comment
Add comment · Show 1
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 EnderSeldon · Aug 02, 2015 at 08:37 AM 0
Share

I have the same problem in the editor. I don't know if this happens playing the build. $$anonymous$$y menu starts disabled when I press play in the editor and it's enabled when I press "Escape". The first selected button on the Event System it's not highlighted. BUT if I press play in the editor with the $$anonymous$$enu enabled, all works fine and the first selected button is highlighted.

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by Isamaru · Jan 13, 2016 at 01:16 PM

I encountered the same issue, and this is probably due to the behaviour of the default Event System implementation when enabling some disable GUI GameObjects.

I found that deselecting and reselecting again via script works as a simple workaround (I do this in my LevelManager script):

 // Deselect and reselect first button to correctly display highlight after enabling parent GO
 EventSystem es = GameObject.Find("EventSystem").GetComponent<EventSystem>();
 es.SetSelectedGameObject(null);
 es.SetSelectedGameObject(es.firstSelectedGameObject);

Note that doing this plays the selection fade/animation again.

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

Answer by kamullis · Aug 09, 2016 at 04:24 PM

@MicDaRoc, not sure if you got this figured out, but I was having the same problem. I tried what @Isamaru suggested and it still wasn't working for me. Then I found this thread

about using coroutines. I'm still really a beginner, self-taught programmer and have never used these before. I'm not sure if I am really implementing it correctly, but I managed to make it work for me. So take this advice with a large grain of salt. Using what @Isamaru suggested above with the following

     IEnumerator highlightBtn()
     {
         myEventSystem.SetSelectedGameObject(null);
         yield return null;
         myEventSystem.SetSelectedGameObject(myEventSystem.firstSelectedGameObject);
     }
 
   void Update () 
       {
 
         if (Input.GetKeyDown (KeyCode.Escape) || Input.GetKeyDown(KeyCode.JoystickButton7)) 
         {
             isPaused = !isPaused;
             StartCoroutine("highlightBtn");
         }
 ...
Comment
Add comment · Show 2 · 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 Gua · Feb 03, 2017 at 11:12 PM 0
Share

Thank you very much!

avatar image AxyGames · Apr 23, 2018 at 03:11 PM 0
Share

Thank you! This is the work around that worked for me!!!

avatar image
-1

Answer by rajavamsidhar_gvs · Jul 21, 2015 at 11:41 AM

once you check this thread link it may help you..

Comment
Add comment · Show 2 · 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 MicDaRoc · Jul 21, 2015 at 03:21 PM 1
Share

Hmm, at first look this link doesn't help much. But thx. I think this may be a Unity Bug... Does anyone know a workaround for my problem?

avatar image rajavamsidhar_gvs · Jul 23, 2015 at 10:08 AM 0
Share

see this forum thread.link

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

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

Related Questions

Basic question about creating a menu 1 Answer

UI Button Focus 2 Answers

New UI buttons not working on top of screen on iOS devices. 3 Answers

UI Button onclick not detected 0 Answers

UI elements stop working based on hirarchy position 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