Skip to content
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

Confusion around node lifecycle and best practices documentation #9290

Open
WillaWisps opened this issue Apr 27, 2024 · 0 comments
Open

Confusion around node lifecycle and best practices documentation #9290

WillaWisps opened this issue Apr 27, 2024 · 0 comments
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement

Comments

@WillaWisps
Copy link

Your Godot version: 4.2.1

Issue description:
Coming from a background of react web development, I would love a page on the lifecycle of nodes, especially with regards to best practices around _ready() and when nodes become visible to the eye (rendering) in the viewport.

Some questions I have:

  • From print statements and breakpoints, it seems like nodes become visible as they enter the tree (_enter_tree()). But if I pause with a breakpoint in Parent A's _ready() function, I don't see Child B rendered in the viewport, despite it having visible == true. Does this mean the rendering of children waits for the parent to be ready?
  • Are there any pros/cons with changing reusable Child B's variables in Parent A's _ready()? Say we want to change a variable called "color" of Child B from red to green because this instance should be green. Is there a frame where Child B is "color" red if we change "color" in Prante A's _ready()? Would it be better to listen to the NOTIFICATION_PARENTED notification (which should happen as the node enters the tree if the nodes are setup by the local hierarchy and not a script) and change the variable instead (maybe bypassing Child B being ready with the incorrect value)?

Potential pages where these changes could go:

@skyace65 skyace65 added the area:manual Issues and PRs related to the Manual/Tutorials section of the documentation label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement
Projects
None yet
Development

No branches or pull requests

2 participants