fallahn/xygine

Check if an entity is valid

zerodarkzone opened this issue · 3 comments

Hi,
is there a way to check if an entity is in a valid state?

Broadly, no, not at the moment. You can check entity.hasComponent<T>() to see if an entity is as you expect, or entity.destroyed()to see if it's marked for destruction on the next update, but other than that there's no specific function. It can probably be added, depending on your definition of 'valid'. For example creating an entity by any means other than Scene::createEntity() will create one without a valid entity manager pointer. If this is the check you need I'll happily add a function for it.

Thanks

Feedback is always appreciated, thanks for giving xygine a try!