#Netcode for entities

1 messages · Page 1 of 1 (latest)

untold stream
#

how can i set a parent to a entity i just created at the server system

CollectBox collectBox = state.EntityManager.GetComponentData<CollectBox>(raycastHit.Entity);

EntitiesReferences entitiesReferences = SystemAPI.GetSingleton<EntitiesReferences>();

Entity missileLauncher = entityCommandBuffer.Instantiate(collectBox.spawnEntity);
entityCommandBuffer.SetComponent(missileLauncher, LocalTransform.FromPosition(float3.zero));
entityCommandBuffer.SetComponent(missileLauncher, new CarObjectFollow { followEntity = entity });

entityCommandBuffer.AddComponent(missileLauncher, new Parent { Value = entity });

if (!state.EntityManager.HasBuffer<LinkedEntityGroup>(carObjectHolder.ValueRO.holdPointEntity))
{
    entityCommandBuffer.AddBuffer<LinkedEntityGroup>(carObjectHolder.ValueRO.holdPointEntity);
}

entityCommandBuffer.AppendToBuffer(carObjectHolder.ValueRO.holdPointEntity, new LinkedEntityGroup
{
    Value = missileLauncher
});


entityCommandBuffer.AddComponent(missileLauncher, new PredictedGhostSpawnRequest());

UnityEngine.Debug.Log(entity);
entityCommandBuffer.DestroyEntity(raycastHit.Entity);
#

when i try it like theese it sets the parent at the server world but not synchronizing trough client world

oak slate
#

Ghost parenting is not synced over the network. But you can use GhostGroup that is similar to LinkedEntityGroup

untold stream
#

ill give it a try thank you

#

but the pratices link doesnt work

#

do u know any tutorial link for ghost group? @oak slate

oak slate
untold stream
#

oky thanks

untold stream
#

i could not find it at the samples really

#

i've found a similar one but thats the version of it with gameobjects

#

@oak slatesorry for spamming pings but i really need to get that