using RpcComponents; using Unity.Burst; using Unity.Collections; using Unity.Entities; using Unity.NetCode; partial struct InitializeLocallySystem : ISystem { [BurstCompile] public void OnCreate(ref SystemState state) { var builder = new EntityQueryBuilder(Allocator.Temp).WithAll().WithNone(); state.RequireForUpdate(state.GetEntityQuery(builder)); } [BurstCompile] public void OnUpdate(ref SystemState state) { EntityCommandBuffer ecb = SystemAPI.GetSingletonRW().ValueRW.CreateCommandBuffer(state.WorldUnmanaged); foreach (var (character, entity) in SystemAPI.Query().WithAll().WithNone().WithEntityAccess()) { ecb.AddComponent(character.ViewEntity, new MainEntityCamera()); ecb.AddComponent(entity, new InitializedLocallyTag()); } } [BurstCompile] public void OnDestroy(ref SystemState state) { } }