|Attention||Topic was automatically imported from the old Question2Answer platform.|
I have set up my game to have a basic scene format that I instance many times over. I want to be able to keep my scene instances organized by attaching them to chapter nodes but the only way I’ve found to be able to export a scene instance path, saved in a variable, is with the NodePath export hint. The problem is, that when I save a scene instance B to another scene instance A, it grabs the relative path to instance B from A. Then the node that calls my change scene function is in another node and I can’t hardcode a way to modify the path if I go from one organizer node to another. Even if I could, I can’t help be feel there should be a better way. Is there a way to specify to the editor that I want to grab an absolute path, rather than a relative one or a better way to save a reference to a scene instance in a scene instance, in the editor?
export (NodePath, "Absolute" ) var node_path_1
I want to be able to easily save a reference to a scene instance to another scene instance from the editor. If there is a better way to do that I’d really appreciate some pointers.
I’m not sure I understood your setup correctly, but in general, I would avdvise you don’t reference nodes from outside your scene. At least, not withing the scene. Notably because it makes your scene unable to work by itself (if you save a scene separately, it is generally good practice to make it self-contained as far as its job goes). Communication between scenes in such a situation should better be done by whichever scene containing the instances, because the container has the necessary context.
Zylann | 2022-03-22 13:50