diff --git a/src/entity.zig b/src/entity.zig index 7d7f286..1e9b0d7 100644 --- a/src/entity.zig +++ b/src/entity.zig @@ -279,7 +279,14 @@ pub fn Entity(comptime ctx: anytype) type { pub fn get(self: Self, comptime T: type) ?*const T { const id = Lookup(ctx, T).id; - return @alignCast(@ptrCast(c.ecs_get_id(self.world.raw, self.raw, id))); + const ptr = c.ecs_get_id(self.world.raw, self.raw, id); + return @alignCast(@ptrCast(ptr)); + } + + pub fn get_mut(self: Self, comptime T: type) ?*T { + const id = Lookup(ctx, T).id; + const ptr = c.ecs_get_mut_id(self.world.raw, self.raw, id); + return @alignCast(@ptrCast(ptr)); } pub fn set(self: Self, comptime T: type, value: T) void {