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

Instantiate nodes using position instead of global_position #141

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

samaritan-sw
Copy link
Contributor

@samaritan-sw samaritan-sw commented Apr 2, 2024

This fixes an issue where every time a node is set to spawn upon another's death, or a spawner is used, a non-fatal error message "Condition !is_inside_tree is true" pops up.

Repro steps: shoot a target in any scene and the error will pop up in the console.

I believe this is due to adding the child to the tree before setting its global_position property. Unfortunately, setting the global_position before adding the child to the tree seems to prevent the node from showing (or at least from spawning in the right position).

Using "position" to instantiate the nodes seems to fix this, and I've observed no change in behaviour - however this solution might not follow best practice, so people more familiar with the engine should feel free to come up with something better if needed.

@samaritan-sw samaritan-sw changed the title Instance nodes using position instead of global_position Instantiate nodes using position instead of global_position Apr 2, 2024
Copy link
Owner

@Phazorknight Phazorknight left a comment

Choose a reason for hiding this comment

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

Thanks for this!
I'm very happy to finally get rid of these messages.
Don't really notice a difference either, I guess we'll see if there's weird behaviour down the line.

@Phazorknight Phazorknight merged commit dead630 into Phazorknight:main Apr 2, 2024
@samaritan-sw samaritan-sw deleted the instancingfix branch April 3, 2024 16:08
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.

2 participants