+4 votes

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.

in Engine by (16 points)

1 Answer

+2 votes

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

by (20 points)

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.

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.