-
For game engines that feature prefabs, how should Svelto.ECS be integrated? Normally prefabs enable designers to configure the game directly in the editor. But since ECS requires factories to build the in-engine objects and ECS entities, is it still possible to use prefabs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I do not suggest using implementors/entityViewComponent to wrap gameobjects. This will 9 times out 10 lead to confusion and consequent abandonment of the ECS pattern. The question then becomes how to fill these managers. you create the gameobjects from loaded prefabs at run time, so it's easy at that point to have a factory and a resource manager injected If you need more details let me know, but I hope I gave you an idea. |
Beta Was this translation helpful? Give feedback.
I do not suggest using implementors/entityViewComponent to wrap gameobjects. This will 9 times out 10 lead to confusion and consequent abandonment of the ECS pattern.
You must instead use the ResourceManagers pattern explained in the article: https://www.sebaslab.com/oop-abstraction-layer-in-a-ecs-centric-application/
The question then becomes how to fill these managers.
You have two options:
you create the gameobjects from loaded prefabs at run time, so it's easy at that point to have a factory and a resource manager injected
OR
you scan the scene and look for gameobjects having particular monobehaviours to mark them as gameobjects for entities.
If you need more details let me know, but …