Export NodePath variable to a external scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By shinspiegel


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?

:bust_in_silhouette: Reply From: shinspiegel

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.

At least you shared the answer with us. :stuck_out_tongue:

Ertain | 2019-03-20 00:01

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

gothrond | 2021-06-25 07:11