Support pointer types in Entity.set

main
copygirl 8 months ago
parent f48a6884ca
commit 5425ba89d5
  1. 3
      src/entity.zig

@ -341,7 +341,8 @@ pub fn Entity(comptime ctx: anytype) type {
pub fn set(self: Self, comptime T: anytype, value: meta.AnyToType(T)) void { pub fn set(self: Self, comptime T: anytype, value: meta.AnyToType(T)) void {
const id = Context.anyToId(T); const id = Context.anyToId(T);
_ = c.ecs_set_id(self.world.raw, self.raw, id, @sizeOf(@TypeOf(value)), &value); const size = @sizeOf(@TypeOf(value));
_ = c.ecs_set_id(self.world.raw, self.raw, id, size, @ptrCast(&value));
} }
/// The `fmt` parameter can be one of: /// The `fmt` parameter can be one of:

Loading…
Cancel
Save