Skip to content

Remove _exit_tree methods from Simple nodes #214

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

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

manuq
Copy link
Contributor

@manuq manuq commented Sep 5, 2024

There is no need for this cleanup because from docs: [1]

If the node has children, its _exit_tree callback will be called last,
after all its children have left the tree.

Also because: [2]

when a node is freed with Object.free or queue_free, it will also free
all its children.

Further, this removes the sprite and collision while in the editor when the user switches to another scene tab #213.

[1] https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-private-method-exit-tree
[2] https://docs.godotengine.org/en/stable/classes/class_node.html#description

Fixes #213

There is no need for this cleanup because from docs: [1]
> If the node has children, its _exit_tree callback will be called last,
> after all its children have left the tree.

Also because: [2]
> when a node is freed with Object.free or queue_free, it will also free
> all its children.

Further, this removes the sprite and collision while in the editor when
the user switches to another scene tab #213.

[1] https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-private-method-exit-tree
[2] https://docs.godotengine.org/en/stable/classes/class_node.html#description

Fixes #213
Copy link
Member

@dbnicholson dbnicholson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. I totally misunderstood what _exit_tree was for. I think the reason I added that was that I was worried that sprite and/or collision would be created but then changed before before they were added to the node. But that can't happen with the current code since their created and added all within _ready.

@dbnicholson dbnicholson merged commit 67def96 into main Sep 5, 2024
3 checks passed
@dbnicholson dbnicholson deleted the 213-fix-simplecharacter branch September 5, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SimpleCharacter texture can dissapear while editing
2 participants