Transform Child buffer does not appear on the root entity

I have a prefab, which is an empty object, that groups several visual objects under itself. When I spawn it, it has no Child buffer but does have LinkedEntityGroup (even though its children have this root entity as a Parent). If I modify the conversion system to add and fill the Child buffer, it appears on prefab but is missing on the instance whenever I instantiate the prefab. Is there a way to make the prefab creating or, at least, preserving its children?

I use the following code in my conversion system, but it seems like the Child buffer appears on the next frame and not at the moment of the prefab’s instantiation. I wonder why.

            var dbfChild = dstManager.AddBuffer<Child>(entity);
            foreach (Transform t in transform)
            {
                var eChild = conversionSystem.GetPrimaryEntity(t);
                dbfChild.Add(new Child() { Value = eChild });
            }

The Child buffer is a system state type that is added by the transform system. System state types aren’t replicated when instantiating entities.

Ouch! I didn’t know that! Thank you!

Well, this still doesn’t help to get the buffer. It just doesn’t appear automagically on the root entity. Is there any way to make an entity hook it’s direct children?

Update the TransformSystemGroup.

1 Like

Awesome thanks! EndFrameParentSystem from TransformSystemGroup did the trick