system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Koroshiya |
Some nodes can be used by properties or functions, to apparently perform the same effect. For example:
get_node("Button1").disabled = true
get_node("Button1").set_disabled(true)
Why ?
What is the difference?
One is better than the other?
system
2
|
|
|
|
Reply From: |
clemens.tolboom |
Have a function gives you more control over what will happen when setting a value.
Your Button has BaseButton implementing disabled
BaseButton
Setting disabled = false
will call set_disabled(false)
under the hood.
A more complex example is ie See ie is_active
var is_active = true setget set_is_active
when settings is_active = true
will call set_is_active(true)
under the hood.
func set_is_active(value):
is_active = value
set_physics_process(value)
set_process_unhandled_input(value)
set_block_signals(not value)
which is a complex action.