The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I design layout for rpg game like this:


When player switch to level 2 by change_scene, I wonder godot released memory which used to load level 1 (tileset, player ...)?

Godot version 3.5
in Engine by (19 points)

1 Answer

0 votes
Best answer

If you used the get_tree().change_scene("*insert the new scene nodes location on project's folder*") action, in theory the entire engine moved to that scene and the other one is gone and released.

You can confirm this usually by the fact that you have to reload the previous scene from scratch if you intend to load that scene again.

Memory is not saved from that previous scene when you change scene, unless you stored it in some sort of singleton.

by (88 points)
selected by

if godot still has the player instance in memory, i have considered putting the whole levels in the main node, showing the tileset when necessary... of course it's quite cumbersome, luckily i don't need to, thanks you answered.

The player instance is not saved.

Let's say you nested each level more or less like this:
main node for the level > assets like tilsets, etc + an instance of player node

whenever the scene is loaded, it loads that tree, and when it's changed that tree is deleted in favor of the new scene you changed into, and this new scene will load everything from their own tree of nodes.

In shot, player is not kept on RAM in-between levels/scenes, so you don't have to worry about it.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.