Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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
1
Question by ggl3dde · May 06, 2020 at 09:50 PM · canvasbuttonsuser interfacedesign

Making a UI menu loop while navigating

Minor question: so I have a simple menu, say the pause menu, where the user can use the keyboard to navigate through the entire list. When the user reaches the top/bottom, the navigation loops around, and they can keep searching the list. All is good. My problem comes from trying to replicate this logic with a more dynamic menu of an unknown amount of buttons. Will I have to manually set the navigation every time to keep it looping, i.e.

     Button topButton = buttons[0];
     Button bottomButton = buttons[buttons.Length - 1];
     // Set top-button
     Navigation topNav = new Navigation();
     topNav.mode = Navigation.Mode.Explicit;
     topNav.selectOnUp = bottomButton;
     topNav.selectOnLeft = bottomButton;
     topNav.selectOnRight = buttons[1];
     topNav.selectOnDown = buttons[1];
     topButton.navigation = topNav;
     // Set bottom-button
     Navigation botNav = new Navigation();
     botNav.mode = Navigation.Mode.Explicit;
     botNav.selectOnUp = buttons[buttons.Length - 2];
     botNav.selectOnLeft = buttons[buttons.Length - 2];
     botNav.selectOnRight = topButton;
     botNav.selectOnDown = topButton;
     bottomButton.navigation = botNav;

It's not the worst but feels a bit messy, especially b/c I'm using object pooling so the menu order won't always be consistent....so I was wondering if there was anything cleaner. Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Phazorknight · Sep 06, 2020 at 10:10 PM

Hey, I know it's been a while, but I'm working at something similar where I have to set the navigation on dynamically created Selectables.

So far I'm pretty much using the same method as you. Creating an Array of the gameobjects and then using the indexes (isn't Indizes the plural?), to change/correct their navigation selects.

I'm also looking for a more elegant solution but wanted to let you know you're not alone.

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

139 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 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 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 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 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

Two panels to fit the size of the parent panel in Portret mode. 0 Answers

How to block "touch input" to scenes loaded below the current scene ? 1 Answer

Strange error with UI Screen overlay - no bugs or warning, game can't be played. - GameOverText.SetActive (false); 0 Answers

UI Buttons dont react on click 4 Answers

Image with transparency cut-offs as button 2 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