_set_physics_process() is always called prior to _ready()

Godot Version

4.3

Question

Is it possible to override a node's _set_physics_process() so that it is not automatically called by the godot engine prior to ready()?

For context, I have a number of Nodes whose physics I would like to disable on instantiation but prior to being added to the scene tree. I.e:
image

I was surprised to find that despite having disabled physics process, the Nodes’ physics process would be enabled upon being added to the scene tree:


I thought that I could override _set_process_physics(enable : bool) → void in a similar manner as _validate_property() i.e.:

…but it seems that this override is never called. A possible solution is to simply disable physics in ready(), but I have many nodes which inherit this script and also override _ready(), so I would like to avoid having to individually write super() in all of them.

Any help on this matter would be greatly appreciated!

No, only functions marked as virtual can be overriden (like _init or _ready) for perfomance reasons.


Yeah, and you can do that in _init, just await the ready signal:

func _init() -> void:
	await ready
	set_physics_process(false)

Ah, this is a clever solution! I tend to avoid using Await since it sometimes leads to race condition scenarios but I think this a perfect use for it. Thanks for the idea!