diff --git a/source/bubel/ecs/manager.d b/source/bubel/ecs/manager.d index 5c343e6..f1edf5c 100644 --- a/source/bubel/ecs/manager.d +++ b/source/bubel/ecs/manager.d @@ -1305,7 +1305,7 @@ export struct EntityManager // static assert(0, "Add \"mixin ECS.Component;\" in top of component structure;"); // } - static if (hasMember!(Comp, "onDestroy") && isFunction!(Comp.onDestroy) + static if (__traits(hasMember, Comp.init, "onDestroy") && isFunction!(Comp.onDestroy) && is(ReturnType!(Comp.onDestroy) == void) && Parameters!(Comp.onDestroy).length == 0) { @@ -1317,7 +1317,7 @@ export struct EntityManager info.destroy_callback = &callDestroy; } - static if (hasMember!(Comp, "onCreate") && isFunction!(Comp.onCreate) + static if (__traits(hasMember, Comp.init, "onCreate") && isFunction!(Comp.onCreate) && is(ReturnType!(Comp.onCreate) == void) && Parameters!(Comp.onCreate).length == 0) { static void callCreate(void* pointer) nothrow @nogc