using System; using Unity.Collections; using Unity.Entities; using Unity.NetCode; using Unity.Rendering; using UnityEngine; namespace Unity.NetCode.Samples.Common { /// /// Every NetworkId has its own unique Debug color. This system sets it. /// [AlwaysSynchronizeSystem] [RequireMatchingQueriesForUpdate] [WorldSystemFilter(WorldSystemFilterFlags.Presentation)] public partial class SetPlayerToDebugColorSystem : SystemBase { protected override void OnUpdate() { Entities.WithAll().WithChangeFilter().ForEach((ref URPMaterialPropertyBaseColor color, in GhostOwnerComponent ghostOwner) => { color.Value = NetworkIdDebugColorUtility.Get(ghostOwner.NetworkId); }).Run(); } } }