Godot 3.0: Export (PackedScene) var bullet #returns null

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ErrorTastic
:warning: Old Version Published before Godot 3 was released.

I’ve tried to solve this through reviewing docs but the GDscript page on the master doc still says I’m typing this correctly.

I’ve dragged and dropped my chosen scene as well as right-click loaded it from the export section of the node properties.

Export (PackedScene) var bullet
...

...
func _input(event):
> print(bullet) #returns Null

Exported property editor displays my chosen scene “Bullet.tscn” as well as it’s image.

Attempts to apply “bullet.instance()” cause error “Nonexistant function ‘instance’ in base: ‘Nil’.”

This is an exact port of functioning code from the stable version of Godot.

EDIT: Solved, Scene from Player.tscn was not in export section of Main.tscn.

:bust_in_silhouette: Reply From: AshTeriyaki

Hey, could you further explain your solution please? I’m having similar issues.

Having the same issue with:

export(Texture) var my_texture

my_texture always seems to be null even though I set it in the inpector.

NaughtyGnosiophile | 2018-07-31 18:21

I know I’m super late but I just ran into this issue and took me a little bit of time to figure out. So if anyone else runs into this you need to add set the script variables in the editor, on the node where you want to use packed the packed screen:

Godot Packed Scene

jgege | 2020-10-26 19:53