Search Unity

Cannot ArchetypeChunk.GetNativeArray on zero-sized component

Discussion in 'Entity Component System' started by 5argon, Nov 26, 2018.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I used an EntityArchetypeQuery with Any conditions as 10 of zero-sized components. When in a job normally I check for component's existence by GetNativeArray with ArchetypeChunkComponentType that I want to check and then if on .Length > 0

    But if they are zero-sized it thows errror. Any better alternative to check component other than adding fields so that they are not zero-sized? Or better than splitting a query into 10 queries producing 10 NativeArray<ArchetypeChunk> just so that I know which ACA contains which zero-sized component?
     
  2. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    Doesn't ArchetypeChunk has a Has method? It uses an ArchetypeChunkComponentType parameter.

    []`s
     
    5argon likes this.
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Wow I totally missed that. I was too fixated on the documentation's explanation. Thank you.

    *Now the only thing left is I wish we can supply ArchetypeChunkComponentType to EntityCommandBuffer as a substitute for TypeManager static access in the job so we could burst compile jobs with ECB