-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigate programatically #4
Comments
Hello 👋 It seems that at the moment of clicking on the button, unity makes this button as current (This can be checked in the button click handler via An event about changing the current in EventSystem object would help a lot, but I didn't find anything suitable. Nevertheless, your task can be solved very simply if you save the currently selected object separately from the EventSystem. Then you can define the next one via In the generalized case, you will need to save the currently selected object to a temporary field. For example, like this script for button: HandlerForButton.cs private GameObject _current;
void Start() {
GetComponent<Button>().onClick.AddListener(() =>
{
var easyTabSolver = new EasyTabSolver();
var next = easyTabSolver.GetNext(_current);
if(next && next.TryGetComponent(out Selectable nextSelectable))
nextSelectable.Select();
});
}
void Update() {
var eventSystemCurrent = EventSystem.current.currentSelectedGameObject;
if(eventSystemCurrent == gameObject) // gameObject is this button
return;
_current = eventSystemCurrent;
} If you need to exclude a button from navigation, you can do this by hanging the I hope my answer was helpful. |
Hello I attached the script you provided to the button object. I wanted to exclude the button from navigation so I attached EasyTab script to the button and set the However I wanted the first text field to have focus set. I created a gameObject and attached the following script to it:
I also attached the first text field to the above script from the inspector. After this, the first text field was focused. Thank you very much for your help |
Setting |
When I press the Tab button, the cursor moves to the next form field. The Tab button works fine. However, I would like the navigation to work on the click of a button. Please see below screenshot. When I click the button, the cursor should be on the top most text field. When I click the button again, the cursor should move to the dropdown. When I click the button again the cursor should move to the bottom text field.
I called this function in the button click handler:
EasyTabIntegration.Globally.Navigate();
, but it did not work. When I click on the button, the cursor moves to the top most text field. When I click on the button again, the cursor stays on the top most text field.Thanks
The text was updated successfully, but these errors were encountered: