Skip to content

Where is the real implementation for commands.entity(id)? #5926

Answered by bjorn3
DasLixou asked this question in Q&A
Discussion options

You must be logged in to vote

This is the full implementation of commands.entity(id):

self.get_entity(entity).unwrap_or_else(|| {
panic!(
"Attempting to create an EntityCommands for entity {:?}, which doesn't exist.",
entity
)
})
It calls get_entity which is defined at
self.entities.contains(entity).then_some(EntityCommands {
entity,
commands: self,
EntityCommands has a bunch of methods which add a command to the commands on which .entity(id) was originally called and use the passed in entity. For exa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DasLixou
Comment options

Answer selected by DasLixou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants