Best way to "deactivate" a non visible room?

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

Think of a map made of rooms, only one room at time is visible, but the player can return to an already visited room(more or less like 2d metroid, zelda dungeons and so on).

Rooms and (3d)graphics aren’t complex so i think it would be very easy but also a waste to delete/re-create a room every time the player enters/exits a room, so what’s the best way to “deactivate” the content of a room?

By “deactivating” i mean no working collisions, no animations, no ia etc, basically everything has to do absolutely nothing to not add work to the cpu.

Or do you think it’s just better to delete and re-create a room every ime?

:bust_in_silhouette: Reply From: njamster

Take a look here. Bottom line: If memory consumption is not an issue in your game, you can remove the room from the tree (which is not the same as deleting it!) on exit and add it back into the tree when entering the room again. Otherwise: yes, you’ll need to remove and re-create the room on each room change.

I read the documentation long time ago and since then i only consult the gdscript and shader pages, so i the meantime i forgot the existence of that page.

2plus2makes5 | 2020-03-29 18:01