Whats the difference between ".property =" and ".set_property()"

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

Almost every, if not every, property have its set_ and get_ counterpart. Whats the difference and what should i use? Example for setters:

obj.position = Vector2.Zero
obj.set_position(Vector2.Zero)

Same with getters:

get_tree().current_scene
get_tree().get_current_scene()
:bust_in_silhouette: Reply From: Bean-bon

How to use setter and getter functions in Godot 4
This one summarizes getters and setters. Maybe not in all use cases but I would assume it follows similar logic across all objects where there may be extra processing done when using getters and setters. It also may not be the case for them all and the exapmles you have given may be identical but have getters and setters available for consistency.

I would say best to use getters and setters unless you know exactly what they do as otherwise there may be some unexpected bahaviour (maybe using set_current_scene has additional variables that get altered along side it), potentially breaking something.