-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Prevent setting parent as itself #8980
Conversation
The fix must also apply to |
Added! |
This doesn't solve the problem for the In this impl<'w> BuildWorldChildren for EntityMut<'w> { With regard to Add the panic in the relevant functions in this impl<'w, 's, 'a> BuildChildren for EntityCommands<'w, 's, 'a> { The current change only solves the issue for parents inserted through commands, and has poor backtraces. |
Yeah, putting checks into EntityMut methods should be better.
I think the panic message might be enough. Waiting for more opinions. |
We still need the same logic for The function |
Technically, the commands then later will call the I would strongly advise to add the check in the This is because the panic is located in a different system than the one that triggered the despawn. Pushing the panic in the |
make sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love adding more ways for commands to panic, but I think that surfacing the error early when the command is initialized is ultimately a nicer UX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of those panics are added not in the commands execution, but in the command creation, so while we could still return a result.
If we want to panic in those methods, a panic section should be added to their docs
Added panics doc |
Objective
Solution