In GameObjects I have a prefab with child objects; such as a car, with a replaceable spoiler. The spoiler always renders in the same local position compared to the parent car model.
In ECS, when I place this prefab in a subscene, the child entities (Spoiler, Rims, etc.) don’t move with the parent entity (car). Per the usual approach to ECS, I found several tutorials and examples that no longer work in ECS now (Unity 6, ECS 1.3.5) about parenting, SharedData, LocalTransform.
I don’t want to just hack the approach. I’m looking for recommendations to parent objects in ECS, or recommendations on restructuring prefabs to work better for ECS.
Here are some assumptions I have now.
- It is better, when possible, to fully combine meshes/materials into a single mesh/material, so multiple entities don’t need to work together.
- Parenting can be expensive.
- It would be more efficient to generate a custom structure/component that contains the multiple meshes and materials needed to render a car, but I would also have to create a custom system to reproduce the draw calls.
- I’m NOT diving into children with separate physics or colliders in this consideration, like wheels.
- Can anyone recommend videos, tutorials or articles that address how to think through this?
- Are there any specific recommendations or considerations to share on this?
- Thanks!