At the top of a script, I'm exposing a packed scene in the inspector, like so:

export (PackedScene) var my_instance

Then, as per normal, I am populating the variable's inspector field with a valid TSCN file.

But then, in my _ready() function, when I try to access the my_instance variable, I get an error indicating that it is Null value.

I'm using this same script pattern in other scripts on other nodes without issue where it works just fine. It's a very common pattern, as you know.

So, why, oh , why, does this one occurrence not want to work?

Anyone see this before?

Well, nevermind. The problem inexplicably fixed itself. I didn't change any code - just loaded a few different projects and then came back to the offending one and POOF, it suddenly worked as expected.

Might just be a glitch but if it does it again, I'll file a bug report.

a month later

Seeing the same behavior here, but loading other projects and going back to the offending one doesn't fix anything. This same exact concept worked fine when I ran through the "Creeps" tutorial where it's used to instantiate a specific Mob. When I try in a new project, I keep getting the exported PackedScene set to null even though the inspector clearly shows a scene loaded.

I've cleared and reloaded the property in the inspector multiple times to no avail. However, I just tried setting the property to a "New PackedScene" and now seeing a non-null value. Back in the inspector, I reselected/reloaded the scene I really want, and now it's working.

When I originally set the value, I drag/dropped the scene from the file explorer panel into the inspector. Thought maybe that had something to do with it...but now that's it's working, it continues to work regardless whether I drag/drop, or use the inspector dropdown to load the desired scene.

Seems "wonky" but is working now.

I have not tested this or anything, but from your descriptions it sounds like it could be a dependency graph/update issue. Would probably be helpful to see your code and how you instantiate the scenes..?

    5 years later

    It worked for me by making the PackedScene resource in the inspector unique.

    a year later

    Still an issue in 2025 with the latest Godot. Got an extremely basic project that consists of 2 scenes. The primary scene that I'm launching and another scene that I'm trying to load as a PackedScene via a .tscn that's being assigned in the editor.

    Megalomaniak Would probably be helpful to see your code and how you instantiate the scenes..?

    The scene can't be instantiated because it's, y'know, null... The only possible way that can be null in this context is if A) null is being assigned at runtime or B) you're accidentally accessing the wrong instance of the object or C) the engine isn't serializing the resource properly in the first place i.e. an engine bug. A and B are certainly ruled out in my case. That variable is only ever read from, not written to, and the owning object is a singleton, so I'm not accidentally accessing the wrong instance.

    I suspect Godot struggles with serializiation, considering I've experienced other serialization issues that I'm sure many others have, like Exported properties not appearing in the editor until after the project has been run at least once (where even Reload Current Project doesn't cause serialization to take.)