A tool to manage transition between different scenes. Scene Manager v1.X.X and v2.X.X is compatible with Godot 3. Scene Manager v3.X.X is compatible with Godot 4.
Note: Scene Manager v2.X.X and v1.X.X has heavily less features.
Recently Added:
Scene Manager UI
reactive to changes on File System
of godot and refreshes the Scene Manager UI
automatically every time an update happens on files in res://
locationScene Manager UI
+ If Reactive is enabled too, after that mechanism, save gets called automatically so that there would be no need to use the save button at allAll:
Scene Manager
function to assume the current scene as the first ever seen scene (to ignore previous scenes and don't go back to them by changing scene to the previous scene)SceneManager
tool will ignore scenes inside folders with .gdignore
file beside themback
(previous scene) functionalityno_effect_change_scene
function added (Just Godot4)change_scene
and no_effect_change_scene
functions (Just Godot4)scene_manager
folder which is inside addons
folder. (don't change the scene_manager
folder name)Project > Project Settings...
then in Plugins
tab, activate scene_manager plugin.Scene Manager
tab on right side of the screen(on default godot theme view) to manage your scenes.Note: After activating Scene Manager
tool, you have access to SceneManager script globally from anywhere in your scripts and you can use it to change scenes and ... (for more information, read SceneManager section)
Note: This tool saves your scenes data inside res://addons/scene_manager/scenes.gd
file, if you want to have your latest changes and avoid redefining your scene keys, do not remove it, do not change it or modify it in anyway.
Note: All demo pictures and gifs are from Godot4 UI.
This is the tool that you will see on your right side of the godot editor after activating scene_manager
plugin. By Add Category button under scenes categories you can create new categories to manage your scenes.
If editing of a scene key causes at least two keys of another scene match, both of them will get red color and you have to fix the duplication, otherwise the plugin does not work properly as you expect it to work.
Every folder that is added inside this section will be ignored and scenes inside them will not get included inside scenes categories section(the section above this section).
Every scene has a button beside them which will open up a menu to configure settings of that specific scene.
From menu of every scene, you can visible or hide scenes and see just hidden or visible scenes in lists by clicking on eye icon at the top of list categories.
As it is visible on previous pictures, it is possible to add sublists in lists and categorize different scenes in different sublists.
All you have to do is drag scenes by their buttons on the left and drop them on other sublists.
Just a simple demo to show some abilities of this addon:
change_scene
function and goes to next scene.Note: You can use SceneManager
node in your game after you activated scene_manager
plugin.
extends Button
@export var scene: String
@export var fade_out_speed: float = 1.0
@export var fade_in_speed: float = 1.0
@export var fade_out_pattern: String = "fade"
@export var fade_in_pattern: String = "fade"
@export var fade_out_smoothness = 0.1 # (float, 0, 1)
@export var fade_in_smoothness = 0.1 # (float, 0, 1)
@export var fade_out_inverted: bool = false
@export var fade_in_inverted: bool = false
@export var color: Color = Color(0, 0, 0)
@export var timeout: float = 0.0
@export var clickable: bool = false
@export var add_to_back: bool = true
@onready var fade_out_options = SceneManager.create_options(fade_out_speed, fade_out_pattern, fade_out_smoothness, fade_out_inverted)
@onready var fade_in_options = SceneManager.create_options(fade_in_speed, fade_in_pattern, fade_in_smoothness, fade_in_inverted)
@onready var general_options = SceneManager.create_general_options(color, timeout, clickable, add_to_back)
func _ready() -> void:
var fade_in_first_scene_options = SceneManager.create_options(1, "fade")
var first_scene_general_options = SceneManager.create_general_options(Color(0, 0, 0), 1, false)
SceneManager.show_first_scene(fade_in_first_scene_options, first_scene_general_options)
# code breaks if scene is not recognizable
SceneManager.validate_scene(scene)
# code breaks if pattern is not recognizable
SceneManager.validate_pattern(fade_out_pattern)
SceneManager.validate_pattern(fade_in_pattern)
func _on_button_button_up():
SceneManager.change_scene(scene, fade_out_options, fade_in_options, general_options)
func _on_reset_button_up():
SceneManager.reset_scene_manager()
func _on_loading_scene_button_up():
SceneManager.set_recorded_scene(scene)
SceneManager.change_scene("loading", fade_out_options, fade_in_options, general_options)
func _on_loading_scene_initialization_button_up():
SceneManager.set_recorded_scene(scene)
SceneManager.change_scene("loading_with_initialization", fade_out_options, fade_in_options, general_options)
func _on_pause_and_resume_button_up():
await SceneManager.pause(fade_out_options, general_options)
await get_tree().create_timer(3).timeout
await SceneManager.resume(fade_in_options, general_options)
extends Control
# Nodes
@onready var progress: ProgressBar = find_child("Progress")
@onready var loading: AnimatedSprite2D = find_child("Loading")
@onready var next: Button = find_child("Next")
func _ready():
SceneManager.load_percent_changed.connect(percent_changed)
SceneManager.load_finished.connect(loading_finished)
SceneManager.load_scene_interactive(SceneManager.get_recorded_scene())
func percent_changed(number: int) -> void:
progress.value = number
func loading_finished() -> void:
loading.visible = false
next.visible = true
func _on_next_button_up():
var fade_out_options = SceneManager.create_options(1.0, "scribbles", 0.2, true)
var fade_in_options = SceneManager.create_options(1.0, "crooked_tiles", 0.2, true)
var general_options = SceneManager.create_general_options(Color(0, 0, 0), 0, false, true)
SceneManager.change_scene_to_loaded_scene(fade_out_options, fade_in_options, general_options)
Note: This example is for someone who needs to generate a world in the background and then show the scene to the user or someone who generally needs to load some data in the background and then show the new scene to the user/player.
extends Control
# Nodes
@onready var progress: ProgressBar = find_child("Progress")
@onready var loading: AnimatedSprite2D = find_child("Loading")
@onready var next: Button = find_child("Next")
@onready var label: Label = find_child("Label")
var gap = 30
func _ready():
SceneManager.load_percent_changed.connect(percent_changed)
SceneManager.load_finished.connect(loading_finished)
SceneManager.load_scene_interactive(SceneManager.get_recorded_scene())
func percent_changed(number: int) -> void:
# the last `gap%` is for the loaded scene itself to load its own data or initialize or world generate or ...
progress.value = max(number - gap, 0)
if progress.value >= 90:
label.text = "World Generation . . ."
func loading_finished() -> void:
# All loading processes are finished now
if progress.value == 100:
loading.visible = false
next.visible = true
label.text = ""
# Loading finishes and world initialization or world generation or whatever you wanna call it will start
elif progress.value == 70:
SceneManager.add_loaded_scene_to_scene_tree()
gap = 0
label.text = "Scene Initialization . . ."
func _on_next_button_up():
var fade_out_options = SceneManager.create_options(1.0, "scribbles", 0.2, true)
var fade_in_options = SceneManager.create_options(1.0, "crooked_tiles", 0.2, true)
var general_options = SceneManager.create_general_options(Color(0, 0, 0), 0, false, true)
SceneManager.change_scene_to_existing_scene_in_scene_tree(fade_out_options, fade_in_options, general_options)
Assume this part is in the new scene which needs some time in the background:
Note: This part emits the signal of load_percent_changed
of SceneManager to inform the loading screen to change the percentage to inform user that something is happening.
Note: After the loading process is finished, load_finished
will be called to inform the loading screen which everything is ready to change to the new scene.
extends Control
var t = Timer.new()
var count = 0
func _ready():
self.add_child(t)
t.timeout.connect(_on_timeout)
t.start(1)
func _on_timeout():
count += 1
if count == 1:
SceneManager.load_percent_changed.emit(80 + randi_range(0, 9))
elif count == 2:
SceneManager.load_percent_changed.emit(90 + randi_range(0, 9))
if count == 3:
SceneManager.load_percent_changed.emit(100)
SceneManager.load_finished.emit()
t.timeout.disconnect(_on_timeout)
t.start(count + 1)
This is the node you use inside your game code and it has these functions:
validate_scene
(key: String) -> void:
validate_pattern
(key: String) -> void:
safe_validate_scene
(key: String) -> bool:
safe_validate_pattern
(key: String) -> bool:
change_scene
(scene: String or PackedScene or Node, fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
Options
objects by calling create_options
function.GeneralOptions
by calling create_general_options
functions.back
as value of scene variable, causes going back to previous scene.null
, ignore
or an empty string as value of scene variable, causes nothing but just showing scene transition and does not change scenes at all.refresh
, reload
or restart
as value of scene variable, causes refreshing the current scene.exit
or quit
as value of scene variable, causes exiting out of the game._
will be ignored.no_effect_change_scene
(scene: String or PackedScene or Node, hold_timeout: float = 0.0, add_to_back: bool = true) -> void:
create_options
(fade_speed: float = 1, fade_pattern: String = "fade", smoothness: float = 0.1, inverted: bool = false) -> Options:
Options
object for change_scene
function.addons/scene_manager/shader_patterns
folder for fading out or fading into the scene. (if you use fade
or an empty string, it causes a simple fade screen transition)create_general_options
(color: Color = Color(0, 0, 0), timeout: float = 0, clickable: bool = true, add_to_back: bool = true) -> GeneralOptions:
show_first_scene
(fade_in_options: Options, general_options: GeneralOptions) -> void:
_ready
function of a node with a script which that node is inside the first scene that game jumps into it and this causes to have a smooth transition into the first game scene.create_options
function.create_general_options
function.reset_scene_manager
() -> void:
back
scene.create_scene_instance
(key: String) -> Node:
set_back_limit
(input: int) -> void:
back
(previous scene) functionality.input
values:
input
or less previous scenesget_scene
(key: String) -> PackedScene:
load_scene_interactive
(key: String) -> void:
load_percent_changed(value: int)
and load_finished
signals to listen to updates on your scene loading status.get_loaded_scene
() -> PackedScene:
change_scene_to_loaded_scene
(fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
change_scene
) to understand what fade_out_options, fade_in_options and general_options are.get_previous_scene
() -> String:
get_previous_scene_at
(index: int) -> String:
pop_previous_scene
() -> String:
previous_scenes_length
() -> int:
set_recorded_scene
(key: String) -> void:
get_recorded_scene
() -> String:
set_recorded_scene
function.add_loaded_scene_to_scene_tree
() -> void:
load_scene_interactive
to load your scene and then have to listen on load_finished
signal and after the signal emits, you call this function and this function adds the loaded scene to the scene tree but exactly behind the current scene so that you still can not see the new scenechange_scene_to_existing_scene_in_scene_tree
(fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
add_loaded_scene_to_scene_tree
function, you call this function after you are sure that the added scene to scene tree is completely ready and functional to change the active scenepause
(fade_out_options: Options, general_options: GeneralOptions) -> void:
resume
function when you need to do something but do not want the player to see it.resume
(fade_in_options: Options, general_options: GeneralOptions) -> void:
pause
function when you need to do something but do not want the player to see it.