+2 votes


Short Question:
How can I use a Export (NodePath) var to select via Inspector a Node external to the scene?

Longer Question:
I want to create a basic script to create a instance of a explosion every time the Health of a enemy reach zero. The explosion is a scene itself and I want to instantiate a different scene for different enemies.

So I though that a export variable could be useful for that, but it only let me choose a Node inside the actual scene, I cannot get a external scene or node.

There is a way to do that without need to hardcode the path for every script?

in Engine by (37 points)

1 Answer

+8 votes
Best answer

I've found how to do that.
To link to another scene, I should use export (PackedScene) var, instead of export (NodePath) var.

Sorry for this post.

by (37 points)
selected by

At least you shared the answer with us. :P

Yes, this totally gave me the answer I needed. TY!

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.