I’m building a panel with a scroll view in it, using vertical scrollbar scroll up and down in it. But right in in the scene there is another object thats using a ToggleGroup to naviagte throug it. Because of that the Scrollbars naviagtion is now set on that object and not the Scroll view. How do I make the Scrollbar navigate on the Scroll view?
In Unity, the Scrollbar component has a property called Navigation, which allows you to control which object should receive navigation events when the user interacts with the scrollbar. By default, the navigation property is set to “Automatic”, which means that the scrollbar will automatically navigate to the first interactive object that is a sibling or child of the scrollbar.
To change the navigation behavior of the scrollbar, you can set the Navigation property to “Explicit”, and then specify the object that should receive navigation events using the SelectOnUp, SelectOnDown, SelectOnLeft, and SelectOnRight properties. For example, if you want the scrollbar to navigate to the scroll view when the user interacts with it, you can set the Navigation property to “Explicit” and then set the SelectOnUp, SelectOnDown, SelectOnLeft, and SelectOnRight properties to the scroll view object, like this:
Scrollbar scrollbar = GetComponent();
scrollbar.navigation = Navigation.Explicit;
scrollbar.selectOnUp = scrollViewObject;
scrollbar.selectOnDown = scrollViewObject;
scrollbar.selectOnLeft = scrollViewObject;
scrollbar.selectOnRight = scrollViewObject;
I hope this helps! Let me know if you have any other questions.