How to scroll to specific element in a scrollcontainer?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By igbow

I have a several button on scroll container and I want to center the view on a specific button when the scene start without loosing the ability to scroll
I tried to use scroll_horizontal property to specify the current horizontal scroll value in the ready function but It doesn’t work no matter what value I use

Can you post your code?

exuin | 2022-03-09 03:51

not much of a code

a little script attached to the scrollcontainer
changing the scroll_horizontal property in the editor show the desired effect but when playing the scene the it goes back to 0

extends ScrollContainer


func _ready():
	scroll_horizontal=600
	pass # Replace with function body.

igbow | 2022-03-09 04:44