Skip to content

Prefabs with ECS? #83

Answered by sebas77
Atlinx asked this question in Q&A
Discussion options

You must be logged in to vote

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 …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Atlinx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
FAQ Svelto FAQs
2 participants