Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Persistent Free

An asset by CookieCherith
The page banner background of a mountain and forest
Persistent Free hero image

Quick Information

0 ratings
Persistent Free icon image
CookieCherith
Persistent Free

A simple plugin for that allows nodes to be persistently freed, so that they are removed even when switching scenes and returning.Doesn't effect scene files in any way, only acts at runtime.

Supported Engine Version
4.4
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
5 hours ago
Git URL
Issue URL

Persistent Free is a simple plugin that allows nodes to be persistently freed, so that they are removed even when switching scenes and returning. Doesn't effect scene files in any way, only acts at runtime.

There's no extra setup needed - everything is handled by the persistent_free.gd file, which exposes functions for persistently freeing nodes.

HOWTO

If you want to persistently free a node, simply use: PersistentFree.persistently_free(your_node)

If you just want to mark a node to be persistently freed next time the scene is loaded, but don't want to free it right now, use: PersistentFree.mark_as_persistently_freed(your_node)

If you want to bring back a persistently freed node the next time its scene is loaded, you'll need its absolute NodePath. Once you have that, use: PersitentFree.undo_persistent_free(your_node_path)

The persistent_free.gd script is commented if you want to look into how it works.

CAVEATS:

1.	PersistentFree uses NodePaths to identify nodes. If you move a node, such as if you reparent it, this changes its path.
    If PersistentFree is told to free a node that isn't at its original path, it will fail and produce an error.

2.	Persistent freeing only takes effect when the scene_changed signal is emitted from your SceneTree.
    PersistentFree will not act on its own at any other time.
    If you change scene manually, consider also manually emitting the scene_changed signal from your SceneTree.

3.	Persistently freed nodes are only removed after the scene has been readied, meaning that they still briefly exist.
    These nodes will still run their _init() and _ready() functions, but will be freed shortly after.

4.	PersistentFree isn't built to be used on nodes that are not within the current_scene, such as autoloads.
    While it can technically be used on such nodes, it's not recommended unless you know what you're doing and have a good reason.

A simple plugin for that allows nodes to be persistently freed,
so that they are removed even when switching scenes and returning.
Doesn't effect scene files in any way, only acts at runtime.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Persistent Free icon image
CookieCherith
Persistent Free

A simple plugin for that allows nodes to be persistently freed, so that they are removed even when switching scenes and returning.Doesn't effect scene files in any way, only acts at runtime.

Supported Engine Version
4.4
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
5 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers