Closed Blunderchips closed 4 years ago
hasComponent takes a ComponentType object as argument, not a Component class. And open this method would bypass component mapper concept (which is recommended for good performance).
what you can do is : entity.getComponent(...) != null
which cover your use case.
Ok, thank you
Access on hasComponent method on
Entity
class has been left as default (protected) leaving it inaccessible. There is no reason for this method to be protected as it is already directly accessible using a ComponentMapper.I require a quick and easy way to determine whether a given
Entity
has a certainComponent
(s) without needing to declare a newComponentMappers
for the sole purpose of callinghasComponent
.Ashley version:
1.8.2