Spawning a Prefab with One Or More Ghosts inside do not work

Using Latest ECS and Netcode for entities:

If you create a Prefab That has two or more ghosts inside (non root level). If you spawn with instantiate at runtime the prefab spawn the same ghost twice incorrectly.

If you drag and drop the prefab in a scene, both ghosts work and show as expected, but during runtime they do not correctly instantiate.

Check the following screens:

Server Entities:
image

Container is the existing Prefab in the Scene, it has both a Sphere and White Object.

The second container, is a Entity That has a system that runs and spawns a prefab with EntityManager.Instantiate

This is the client view:
image

You can clearly see that White was spawn twice instead on the client.
If I move the Sphere in the server view, a wrong ghost is moved in the client.

This is the game view:
Top is the Prefab dropped in the subscene , correctly working with both a cube and sphere.
Bottom is supposed to be the same thing, but its instead two cubes on top of each other
image

In the same way, all the components that are specific to the Sphere Object are missing in the client and present in the server.

Adding a Ghost Component to the root level Authoring Game Object, prevents the ghosts from being spawn on the client altogether, and in this situation, the Root Level is just a requirement to group both prefabs into a single drag and drop Object. Does not need to replicated or synced in anyway.

Is this expected behaviour? Because it looks clearly a bug, and if not a bug, is this behaviour written anywhere on the documentation?

No, this is not expected as far as I know. Or at the very least it should be printing an error message for you to explain it’s not allowed. Seems we don’t cover this properly in the docs.

The ghost (or ghost authoring component) should be at the root level (ghost components can be nested/children), but it can be in a container non-prefab object in a scene for organisation purposes there. Technically we could maybe just make this scenario work, instead of just printing an error but needs looking into (matter of prioritisation/effort). You could file a bug report and let me know so you can track the status, or I’ll just create one for the team internally.

I am fine with you creating one internally, I was pulling my hair out trying to find what I was doing wrong in the setup. I am actually glad that its not a mistake in my part ahaha.

The top level object is purely for organisation and to make instantiating “complex” structures easier in my case.

I haven`t really looked into the ghost system code, maybe I can work something out - but my gut instinct is telling me this is a baking issue perhaps.

None the less, do you have any recommended workflows to work around this, or this will just be a no go for now? As in, if I want to spawn multiple ghosts with one instantiate (examples would be for a example a pile of boxes stacked).