Fix iterator not working with fixed terms

wip/source-generators
copygirl 2 years ago
parent db73b54d53
commit cf6c050501
  1. 3
      src/gaemstone/ECS/Iterator.cs

@ -51,8 +51,9 @@ public unsafe partial class Iterator
{
fixed (ecs_iter_t* ptr = &Value) {
var size = (ulong)Unsafe.SizeOf<T>();
var isSelf = ecs_field_is_self(ptr, index);
var pointer = ecs_field_w_size(ptr, size, index);
return new Span<T>(pointer, Count);
return new(pointer, isSelf ? Count : 1);
}
}

Loading…
Cancel
Save