How to "disable" nodes?

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

I’d like to keep some nodes loaded into memory but not have them do anything. I know turning off their visibility literally just makes them invisible and doesn’t help at all.

I’ve wondered if temporarily turning them into orphan nodes would work, but it sounds like a bad thing to do.

:bust_in_silhouette: Reply From: Erythrochroism

Have you tried using set_process(false)?

This seems to do the trick for nodes that have scripts attached, at least. I need to call it as a deferred function to make it work half the time though, but okay.

pbaggers | 2020-08-14 02:11

:bust_in_silhouette: Reply From: mdubaisi

you can have them paused and when you need them you can unpause them

:bust_in_silhouette: Reply From: Hyper Sonic

For Godot 4, see https://github.com/godotengine/godot-proposals/issues/1835

Code: node.set_process_mode(PROCESS_MODE_DISABLED) (see doc for other process modes)

Editor: select node, scroll to the bottom of the inspector and modify the Mode property via dropdown to the same enum values as in code

changing node process mode in editor