// returns the index of the component version of the data in the cache public static int GetOrAddMovementIdx(BulletMovementData moveData) { if (!movementStatsCache.IsCreated) { movementStatsCache = new NativeList <BulletMovement>(Allocator.Persistent); } if (!movementIdx.ContainsKey(moveData)) { movementStatsCache.Add(moveData.ToBulletMovement()); movementIdx.Add(moveData, movementStatsCache.Length - 1); } return(movementIdx[moveData]); }