Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 AbstractMagi · Nov 29, 2014 at 07:58 AM · uinavigationselect

Changing the Select on Up / Select on Down in Navigation via script

I'm trying to find out how to change the Select on Up and the Select on Down under Navigation in the button script. I took a look at the script reference for UI.Selectable, but I couldn't find anything to change it, only to find other buttons. I suppose I could set the selected button manually in the script when the player presses up or down, but I would much rather find a way to change the navigation instead. The reason I need to do this is because the buttons are prefabs instantiated seperately based on an array, so the button above / below won't be necessarily be same (but they can be if need be), and when I tried to set the navigation in the prefabs(a long shot to be sure), they accepted the information and kept it, but still didn't navigate.

P.S I apologize for the run on sentences, it's a bad habit of mine.

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
8

Answer by Zelek · Jan 20, 2015 at 10:57 AM

Just ran into this same issue here. It looks like you just need to create a new Navigation struct and then assign it like so:

 Navigation customNav = new Navigation();
 customNav.mode = Navigation.Mode.Explicit;
 customNav.selectOnDown = someSpecificSelectable;
 _myObject.navigation = customNav;

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
2

Answer by DigitalDesignDude · May 22, 2020 at 06:49 AM

Adding on to what Zelek shared to make it easier for those less experienced.

 using UnityEngine.UI;
 
 public GameObject MyButton1;
 public GameObject MyButton2;
 
 public GameObject ObjectToHaveNewNav;
 
 
 //Create a new navigation
 Navigation NewNav = new Navigation();
 NewNav.mode = Navigation.Mode.Explicit;
 
 //Set what you want to be selected on down, up, left or right;
 NewNav.selectOnUp = MyButton1.GetComponent<Button>();
 NewNav.selectOnDown = MyButton2.GetComponent<Button>();
 
 
 //Assign the new navigation to your desired button or ui Object
 ObjectToHaveNewNav.GetComponent<Button>().navigation = NewNav;
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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Navigating UI Buttons with Arrow Keys not working 1 Answer

Focus on/select (TMP) input field? 2 Answers

InputField disable selecting 1 Answer

Get button under mouse 1 Answer

Automatic navigation does not work with Inherited InputField 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