-
Notifications
You must be signed in to change notification settings - Fork 1
Auto Scroll
Luke Mirman edited this page Sep 7, 2022
·
2 revisions
By default the canvas Scrollbar does not move its position when a Selectable is selected.
The purpose of this script then is to to update a Scrollbar's value to include the rect of a child selectable inside the viewport when selected.
- In the canvas hierarchy add the
Autoscrollto the game object with theScrollRectcomponent. - Enter playmode and verify the
ScrollRectcomponent updates when a childSelectableis selected. - If you are dynamically adding or removing selectables into the scroll rect make sure to use either the
SetDirty(int)method orRefreshList()to update the candidates for the Autoscroll list. This method is somewhat expensive so only invoke it when necessary.
- Currently only vertical position is supported, however a future update will add support for horizontal position updating.