This is a Deep Profile with 1000 agents which obviously inflates the CPU times shown on the right-most column.
![]()
Each of our agents runs this in a network tick:
public override void FixedUpdateNetwork() {
if (HasStateAuthority && m_FollowerEntity.enabled) {
Vector3 position = m_FollowerEntity.position;
Quaternion rotation = m_FollowerEntity.rotation;
transform.SetPositionAndRotation(position, rotation);
State.Position = position;
State.Rotation = rotation;
}
}
To optimize further, it would be great if there was a call that could get both values at once with a single ECS lookup. e.g.
public void GetPositionAndRotation(out Vector3 position, out Quaternion rotation) {
if (entityStorageCache.GetComponentData(world, entity, ref localTransformAccessRO, out var localTransform)) {
position = localTransform.value.Position;
rotation = localTransform.value.Rotation;
} else {
position = default;
rotation = Quaternion.identity;
}
}