Search Unity

Storing a Lookup Table in a Component

Discussion in 'Data Oriented Technology Stack' started by PublicEnumE, Nov 19, 2019.

  1. PublicEnumE

    PublicEnumE

    Joined:
    Feb 3, 2019
    Posts:
    160
    Is there a good way to store a lookup table in an IComponentData?

    Right now I’m using two DynamicBuffers:
    1. An array of keys
    2. An array of corresponding values

    The code must iterate over the keys in the first DB, to find the index of the correct value in the second DB.

    Very old school. Not efficient, but it works.

    Would there be a better way to do this in Unity’s ECS?
     
  2. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,043
    Scorr likes this.
  3. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    750
    BlabAssetReference might actually be what you are after.
     
    recursive likes this.