-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scene unique nodes should be globally accessible #5133
Comments
Indeed, Scene Unique Nodes' implementation does not account the cases where scenes are nested in one another, but the solution proposed here can prove more problematic in the long run. See also: #4601 |
Does referencing the parent scene in my example still cache the unique node? Cause if so, they're still useful in separate scenes. |
Well, they are called scene unique for a reason. This is a scene-based mechanism, and to have global unique nodes it cannot be used as is. With the introduction of the
This doesn't seem to be a fair answer to the question about possible workarounds. You have demonstrated a workaround. And to scale it globally you can have an autoload singleton with node references too.
Unfortunately, this is not sufficient for a technical proposal. Please refer to the aforementioned discussion (#4601) or start a new one. |
Okay, but can you answer if accessing them from a parent node is still cached or not? If so, it's not much of a problem as it'll still allow for a single reference without a huge path chain, and it won't be as slow as finding a node by name. |
That's a headscratcher. Whatever ends up done, this limitation needs to be better documented... |
I have to watch this video just to remember how to write the unique node syntax: https://www.youtube.com/watch?v=HKaPTdZKG8Y |
Currently,
Thank you for being the "case" of the point these proposals have predicted was going to happen: #5048 , #5064 (❤️) |
Describe the project you are working on
3D first-person action game.
Describe the problem or limitation you are having in your project
I'm trying to access scene unique nodes from a separate scene and they don't work as expected. When trying this code:
It gives me an error:
But forcing it to check on the parent scene that contains it, does work:
Describe the feature / enhancement and how it helps to overcome the problem or limitation
It would allow scene unique nodes to be simpler to use when they're not inside the same scene as they're called from (most UI's will be in a different scene from the script that keep track of the amount items held in a game).
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Just allow the node to be accessed as usual without needing a parent reference for unique scene nodes in separate scenes from where they're called from.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, needs to be a GDScript adjustment.
Is there a reason why this should be core and not an add-on in the asset library?
No, needs to be a GDScript adjustment.
The text was updated successfully, but these errors were encountered: