Storing a Lookup Table in a Component

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?

You can use my collections: GitHub - fholm/UnsafeCollections: A collection of collections for 'unsafe' C# code which can be stored directly on a component

1 Like

BlabAssetReference might actually be what you are after.

1 Like