Godot Setget
#Both setter and getter:
var my_var setget my_var_set, my_var_get
func my_var_set(new_value):
my_var = new_value
func my_var_get():
return my_var # Getter must return a value.
#Only a setter
var my_var = 5 setget myvar_set
#Only a getter
var my_var = 5 setget ,myvar_get
Docs:
https://docs.godotengine.org/en/3.0/getting_started/scripting/gdscript/gdscript_basics.html?highlight=setget#setters-getters
Crazy Caracal