Having one child-evel works normally, but as soon as I add any child inside a child entity this exception is thrown.
(when clicking update component list)
Is this a known limitation on the depth of the hierarchy supported by ghost entities?
If you’re down to modifying the Netcode package, replacing SyncComponentList method in the GhostAuthoringComponentEditor script (around line 521) with the following code should fix the issue:
public void SyncComponentList(GhostAuthoringComponent self)
{
using (var tempWorld = new World("TempGhostConversion"))
using (var blobAssetStore = new BlobAssetStore())
{
self.ForcePrefabConversion = true;
var convertedEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(self.gameObject,
GameObjectConversionSettings.FromWorld(tempWorld, blobAssetStore));
self.ForcePrefabConversion = false;
var newComponents = new List<SerializedComponentData>();
AddToComponentList(newComponents, tempWorld, convertedEntity, 0, self.gameObject);
if (tempWorld.EntityManager.HasComponent<LinkedEntityGroup>(convertedEntity))
{
var transformGroup = self.GetComponentsInChildren<Transform>(true);
var linkedEntityGroup = tempWorld.EntityManager.GetBuffer<LinkedEntityGroup>(convertedEntity);
for (int i = 1; i < linkedEntityGroup.Length; ++i)
{
AddToComponentList(newComponents, tempWorld, linkedEntityGroup[i].Value, i, transformGroup[i].gameObject);
}
}
Components = newComponents.ToArray();
}
}
In general you can have complex hierarchy BUT the replicated components must be only on the root or 1st children level.
We don’t support having GhostComponent on child objects for deeper hierarchy level. Note that transforms are also not replicated by default for child entities and should not constitute a problem.
There is a known issue (fixed in later NetCode, that should be out soon) that happen if you prefab presents components that generate during conversion multiple entities for the same game object.
On example of them is the MeshRenderer when multiple material (or some configuration for lighting probe) are present. In that case, due to the way the HybridRenderer works, multiple entities are created, one for each material, and the SyncComponentList will crash, trying to accessing an child out of bound.
Please Anyone help me to fix this issue i shall be very thankfull.
UnityException: Transform child out of bounds
DetectVehicle.OnTriggerEnter (UnityEngine.Collider coll)
The original issue should be already fixed in latest 0.5 and 0.51.
If you are trying to have replicated component in the second level of the hierarchy, it will not replicated but should not crash,
I really need more details to help you out here.