Error "loaded scene is not defined" although scene is in ignore list
Closed this issue ยท 6 comments
I added "res://addons" to Ignores list. But when I try to run a scene from there, scene manager crashes with:
"Scene Manager Error: loaded scene is not defined in scene manager tool, to fix this, on Scene Manager UI panel, just once click on refresh and then save buttons."
Obviously clicking refresh and save won't help, because the scenes are ignored.
I think ignored paths should be checked at this point:
https://github.com/maktoobgar/scene_manager/blob/main/addons/scene_manager/scene_manager.gd#L48
Hello.
I don't understand if you are serious or not. You ignored a folder so obviously you can not have access to those scenes inside that folder from scene manager.
That is what I implemented.
That error message is intended to happen.
Can you please elaborate on that a little bit.
Hey there, I'm totally serious ๐ Maybe I'm dumb and I don't get it right...!?
But in my opinion you should be able to start scenes independently, even if they are ignored by SceneManager as long as you don't try to use SceneManager in it. And this seems not to working at the moment.
For example (but it's not limited to the following plugin): I installed Dialogic addon and there is a feature to preview the dialog style. And opening this, the mentioned error was thrown.
Oooookay... I see, and no, you are not dumb my friend, we're just having a misunderstanding.
So you have a scene and you start it and then suddenly you get that error message.
I get it now, that's not a friendly experience.
But you see, the problem is that SceneManager tries to keep track of all scenes it has ever seen on the lifetime of the app/game so that if you ever intend to go back to any of those previous scenes, you could easily do it with the 'back' key name because SceneManager keeps track of those previous scenes in the background.
When you try to run a scene which SceneManager doesn't have a record for it in its dictionary, on the start of the app/game, it tries to look that scene up in its dictionary but it fails and that's why you get that error message.
What I propose as a solution for this specific scenario, is that when SceneManager can't keep track of a scene, instead of giving a big assert error on run time, it can just prints that error message.
Is this a good solution?
Thank you for further investigating this ๐ Yeah, I think your idea could be a solution. But on the other hand I think the current implementation isn't wrong, concerning scenes which are indeed handled by the scene manager. But I had this problem with scenes I willfully ignored by putting them in the ignore list.
Example:
- I have a scene in "res://addons/test/my_scene.gd"
- I have "res://addons" in ignore list
- I open
my_scene.gd
at game start, to only test this specific scene ("Play current scene") - and get the assert error
So my guess would be to add a check here:
https://github.com/maktoobgar/scene_manager/blob/main/addons/scene_manager/scene_manager.gd#L48
func _set_current_scene() -> void:
var root_key: String = get_tree().current_scene.scene_file_path
_current_scene = _get_scene_key_by_value(root_key)
if _current_scene_is_not_ignored(_current_scene):
assert(...)
else:
# do nothing, because scene manager isn't needed here
Ohhh... you're right...
I get it now.
This is much better, I will implement this later but right now I'm not really rich on free time. (other places need change so that scene manager works properly)
Thanks for noticing a problem and taking your time to describe it here.
I appreciate it. ๐โค๏ธ
This is fixed now.
If found any weird behavior, I would appreciate to get a heads up again. ๐