Is there a way to get notified when a built-in property that doesn't have a signal changed?

Godot Version

4.2

Question

In my case, the property is BaseButton’s disabled.
I’m aware that you could just use _process to check if the property’s value changed, but just in case if there is a more efficient way to do this.

You could create a custom BaseButton with a script like this:

signal disabled_changed(value)

func disable(value: bool) -> void:
  disabled = value
  disabled_changed.emit(disabled)
1 Like

Yeah, I was aware of that too (forgot to mention it). Then the question would be Is there a way to hide a built-in property? or something. :smiling_face_with_tear:

Anyway, thank you for the answer.

1 Like

What do you mean by hiding a built-in property? Do you mean you would still want to be able to change it directly (button.disabled = false)? I’m not sure but I think you can override set_disabled function and then disable the error/warning it causes but that’s likely a bad practice.

Welp, just in case if I forget to use the functions (disable, enable) instead of change it directly.

Seems risky. I’m not gonna use it because it might create a new problem.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.