Added note to used set_deferred while setting scroll values in _ready function.

(cherry picked from commit 83626ab90db2dee1152d3e147e44aac658b92067)
This commit is contained in:
stmSi 2023-04-29 23:16:38 +06:30 committed by Relintai
parent eea5d96503
commit ec6ed1f398

View File

@ -47,12 +47,22 @@
</member>
<member name="scroll_horizontal" type="int" setter="set_h_scroll" getter="get_h_scroll" default="0">
The current horizontal scroll value.
[b]Note:[/b] If you are setting this value in the [method Node._ready] function or earlier, it needs to be wrapped with [method Object.set_deferred], since scroll bar's [member Range.max_value] is not initialized yet.
[codeblock]
func _ready():
set_deferred("scroll_horizontal", 600)
[/codeblock]
</member>
<member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" default="true">
If [code]true[/code], enables horizontal scrolling.
</member>
<member name="scroll_vertical" type="int" setter="set_v_scroll" getter="get_v_scroll" default="0">
The current vertical scroll value.
[b]Note:[/b] Setting it early needs to be deferred, just like in [member scroll_horizontal].
[codeblock]
func _ready():
set_deferred("scroll_vertical", 600)
[/codeblock]
</member>
<member name="scroll_vertical_enabled" type="bool" setter="set_enable_v_scroll" getter="is_v_scroll_enabled" default="true">
If [code]true[/code], enables vertical scrolling.