Hello team, I've been stuck on debugging this issue where the system updating in PredictedSimulationSystemGroup is failing to update the LocalTransform of an entity using an IInputComponentData.
It looks like the IInputComponentData component actually updates properly on both the server and client world, but calling localTransform.ValueRW.Position = location; doesn't update the LocalTransform on the server world.
foreach (var (blueprintOwner, localTransform, inputComponent) in SystemAPI.Query<RefRO<GhostOwner>, RefRW<LocalTransform>, RefRO<BuildingBlueprintInputComponent>>().WithAll<Simulate>())
{
foreach (var (playerGhostOwner, playerEntity) in SystemAPI.Query<RefRO<GhostOwner>>().WithAll<PlayerComponent>().WithEntityAccess())
{
if (blueprintOwner.ValueRO.NetworkId != playerGhostOwner.ValueRO.NetworkId)
continue;
Camera playerCamera = PlayerCameraHelper.GetPlayerCamera(playerEntity, state.EntityManager);
if (playerCamera == null)
{
Debug.LogError("No Camera found on player entity!");
continue;
}
var location = ScreenToWorld(inputComponent.ValueRO.MousePos, localTransform.ValueRO, playerCamera, collisionWorld);
if (!location.Equals(Vector3.zero))
{
localTransform.ValueRW.Position = location;
Debug.Log($"localTransform.Position set to {localTransform.ValueRW.Position}");
}
if (inputComponent.ValueRO.LeftClick == 1.0f)
{
Entity placeBuildingEntity = ecb.CreateEntity();
ecb.AddComponent<BuildingPlacedRpc>(placeBuildingEntity);
ecb.AddComponent<SendRpcCommandRequest>(placeBuildingEntity);
}
}
}
For context, the Entity is a ghost entity that has both GhostAuthoringComponent and a GhostAuthoringInspectionComponent and has the DefaultGhostMode set to Owner Predicted and SupportAutoCommandTarget enabled.
I would appreciate any feedbacks!