Skip to content

1.2.3

Compare
Choose a tag to compare
@genaray genaray released this 19 Mar 19:04
· 301 commits to master since this release
f69c231

Bug fixes & Changes

  • Fixed a bug where frequent adding/removing components caused a messed up EntityInfo dictionary and a crash sooner or later.
  • Fixed a bug where adding components by a QueryDescription did not set its value correctly, this was now fixed as well.
  • Fixed BitSet.None, which now works correctly with large amounts of components.
  • Removed struct constraints on EntityExtension methods.
  • Entity.Set now uses default values
  • CommandBuffer methods now make use of default values.

New Features

  • World.Clear() was introduced and clears the whole world.
  • World.GetEntities(Span<Entity> ...); was introduced as an alternative to lists, soon all the available API will make use of spans.
  • ComponentRegistry features a method to register a ComponentType, therefore the user can register custom types.

ComponentRegistry.Add(ComponentType);

Arch tries to support so called managed structs. However, this is not always fully possible due to compatibility with a type-based API. And the existing C# Marshal methods are not always able to recognize managed structs and determine their size.

Therefore, a method has now been added to the ComponentRegister to allow the user to register components independently. He can specify the size himself and thus it is now also possible to add all managed structs.

public struct ManagedStruct{ public List<int> SomeInts{ get; set; } }

// Register
var componentType = new ComponentType(ComponentRegistry.Size, typeof(ManagedStruct), 8, false); // 8 = Size in bytes of the managed struct.
ComponentRegistry.Add(componentType);

// Use
var entity = world.Create(new ManagedStruct());

Contributions

Thanks to @DrSmugleaf for the PRs and fixing the compatibility with #define pure_ecs :)