using Unity.Collections; using Unity.Entities; namespace jeanf.scenemanagement { [UpdateAfter(typeof(VolumeSystem))] public partial class LocationUpdateNotificationSystem : SystemBase { private EndSimulationEntityCommandBufferSystem _ecbSystem; protected override void OnCreate() { base.OnCreate(); _ecbSystem = World.GetOrCreateSystemManaged(); } protected override void OnUpdate() { var ecb = _ecbSystem.CreateCommandBuffer(); foreach (var (notification, entity) in SystemAPI.Query>().WithEntityAccess()) { WorldManager.NotifyZoneChangeFromECS(notification.ValueRO.ZoneId); ecb.DestroyEntity(entity); } foreach (var (notification, entity) in SystemAPI.Query>().WithEntityAccess()) { WorldManager.NotifyRegionChangeFromECS(notification.ValueRO.RegionId); ecb.DestroyEntity(entity); } } } public struct ZoneChangeNotificationComponent : IComponentData { public FixedString128Bytes ZoneId; } public struct RegionChangeNotificationComponent : IComponentData { public FixedString128Bytes RegionId; } }