#Pass dynamic count of `DynamicComponentTypeHandle` into job
1 messages · Page 1 of 1 (latest)
Oh I had this exact issue, I wanted to pass in N number of dynamic type handles
I can't remember how I solved it, I think I wrote something custom
I'll try find it when I get to a pc
That said maybe for your problem masks are better?
you mean mask for IEnableableComponent ?
you could use the typeindex, maybe?
depending what you're trying to do with the info
@rapid briar I'm using chunk.Has(ref DynamicComponentTypeHandle) to check if I have any chunks with wrong component setup
couldn't you do chunk.Archetype.GetComponentTypes
will check
no, entityquerymask
anyway i'm at pc, let me see if i ended up finding a solution for myself for this or just did it a different way, i don't recall what code i wanted this for
never thought what it is and what it for
fast way to know if an entity matches multiple components
but yeah it's not really suitable here because it's for entities not chunks
but if you had somehting like
HasComponent<A> && HasComponent<B> && HasComponent<C>
you can replace it with a mask of abc and do it in a single check
Mask.Matches(entity)
oh wait i'm wrong
you can use EntityQueryMask on chunks
is it any more optimal then one by one checking or just syntax thing?
so you could use this if you wanted to match X components
more optimal
so i guess question is, are you trying to match every component?
will remember, thank you, useful thing for complex growing logic
yes, but I can't predict types of components at compile time
you don't need to
you can generate a entityquery dynamically
and generate the mask from that and pass it into the j ob
oh ok, but still want to check per chunk
you can
hmm, will check, thank you
[BurstCompile]
private struct TestJob : IJobChunk
{
public EntityQueryMask Mask;
public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
{
if (!Mask.MatchesIgnoreFilter(chunk))
{
return;
}
}```
state.GetEntityQuery(GetComponentTypes()).GetEntityQueryMask()
can use builder etc
🙏
but basically just create a query from components or whatever you want to match
you can use None/Any/WithAll etc as well via description
you're just checking if the chunk matches the query
Thank you a lot! One another my issue solved with your advice 🤝