Open Mautar55 opened 4 years ago
You can use get_node("/root")
or $"/root"
as a shorthand for get_tree().get_root().
This one is tightly related to #260 proposal.
This one is tightly related to #260 proposal.
True. That one is even a lot better. Should I delete this one?
This proposal talks about being able to simplify root node instancing specifically so I'd keep this open for discussion in my opinion.
Meta: I previously talked about how different proposals can be seen as different use cases supporting the same idea, this is one of these instances (no pun intended!).
Describe the project you are working on: A bullet hell filled with objects beign create and destroyed with controlled transformations.
Describe the problem or limitation you are having in your project: On every project i work on, i instantiate some elements directly at the root of the scene as children nodes, this is a standard feature of almost every game. The problem comes (and came) when i had to teach how to use nodes to reach the root and add children to them. Many find weird the node tree at the beggining and feel odd to need to reach the parent and transform it to the corresponding position.
var instance instance = preloaded_resource.instance() instancia.transform = transform get_tree().get_root().add_child(instance)
Describe how this feature / enhancement will help you overcome this problem or limitation: New functions for instancian, adding and tranforming will make the code cleaner and easy to understand. Specially for newcomers.
Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
Describe implementation detail for your proposal (in code), if possible: I propose add 4 new standard functions to keep the code cleaner and understandable:
If this enhancement will not be used often, can it be worked around with a few lines of script?: Yes it can, but is used VERY often.
Is there a reason why this should be core and not an add-on in the asset library?: It has use cases to most of the projects.