Hi,
using static functions inside of jobs really helps to keep code clean. But somehow I’m restricted to just general solutions. Is there a method to use functions like “HasComponent<>()” inside a static function, e.g.:
Entities
.ForEach(
(Entity entity, int entityInQueryIndex) => {
bool test = CheckIfComponentExists(entity);
if(test){...}
}).ScheduleParallel();
public static bool CheckIfComponentExists(Entity entity) {
if (HasComponent<MYCOMPONENT>(entity)) {
return true;
}
return false;
}
If I try to structure my code like this an error with missing object reference appears. Can somebody help me?