I’ve been trying to get on the ECS train, I’ve been following this tutorial
In this they use ComponentDataProxy to attach component data to a prefab. However in the ECS samples on github they use a MonoBehaviour implementing IConvertGameObjectToEntity.
Both appear to still work, is either of them considered better than the other? Are there situations where you would use one over the other?
I think the method in the video tutorials is the old one, the one in the samples is the new thing. The one in the sample is nice, but is meant as a way to convert your GameObjects to pure ECS. It’s a faster way since you can create subscenes and such, but if you still need to use MonoBehaviours that won’t convert to ECS (old physics, UI, Animators, etc), you will need a way to keep those and create an entity in parallel for your GameObject.
Honestly, for that kind of thing, I usually just create a MonoBehaviour which creates and keeps track of an entity in the active world and add/set components by hand. That way I have more control of how I manage both GameObject/MonoBehaviour and Entity/Component in parallel. Until DOTS has matured quite a bit more, you may have to find a way to juggle with both like I do.
You can read about the conversion workflow here.
I think some of the samples links might be dead but it will give you a great overview of how it works.