Skip to content

Commit

Permalink
fix component list in EntityDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
sicusa committed Apr 4, 2024
1 parent 8d74074 commit e01aca9
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions Sia/Entities/EntityDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Frozen;
using System.Collections.Immutable;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

public record struct ComponentInfo(Type Type, IntPtr Offset);

Expand All @@ -24,11 +23,7 @@ public readonly void Handle<T>(ref T value)
if (!offsets.TryAdd(typeof(T), offset)) {
throw new InvalidDataException("Entity cannot have multiple components of the same type");
}
var index = EntityComponentIndexer<TEntity, T>.Index;
if (index >= components.Count) {
CollectionsMarshal.SetCount(components, index + 1);
}
components[index] = new(typeof(T), offset);
components.Add(new(typeof(T), offset));
}
}

Expand Down

0 comments on commit e01aca9

Please sign in to comment.