Michele Caini 6 سال پیش
والد
کامیت
14034642f1
2فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 3 0
      test/lib/registry/lib.cpp
  2. 2 0
      test/plugin/registry/plugin.cpp

+ 3 - 0
test/lib/registry/lib.cpp

@@ -10,6 +10,9 @@ ENTT_API void update_position(entt::registry &registry) {
 }
 
 ENTT_API void assign_velocity(entt::registry &registry) {
+    // forces the creation of the pool for the velocity component
+    registry.prepare<velocity>();
+
     for(auto entity: registry.view<position>()) {
         registry.assign<velocity>(entity, 1., 1.);
     }

+ 2 - 0
test/plugin/registry/plugin.cpp

@@ -7,6 +7,8 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
     case CR_STEP:
         [ctx]() {
             auto *registry = static_cast<entt::registry *>(ctx->userdata);
+            // forces the creation of the pool for the velocity component
+            registry->prepare<velocity>();
 
             for(auto entity: registry->view<position>()) {
                 registry->assign<velocity>(entity, 1., 1.);