protected override void OnCreate() { m_GhostCollectionSystem = World.GetOrCreateSystem <GhostCollectionSystem>(); m_ghostEntityMap = new NativeHashMap <int, Entity>(2048, Allocator.Persistent); m_spawnedGhostEntityMap = new NativeHashMap <SpawnedGhost, Entity>(2048, Allocator.Persistent); playerGroup = GetEntityQuery( ComponentType.ReadWrite <NetworkStreamConnection>(), ComponentType.ReadOnly <NetworkStreamInGame>(), ComponentType.Exclude <NetworkStreamDisconnected>()); ghostCleanupGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(), ComponentType.Exclude <PreSpawnedGhostId>()); clearJobGroup = GetEntityQuery(ComponentType.ReadOnly <GhostComponent>(), ComponentType.Exclude <PreSpawnedGhostId>()); m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent); #if UNITY_EDITOR || DEVELOPMENT_BUILD m_StatsCollection = World.GetOrCreateSystem <GhostStatsCollectionSystem>(); #endif m_GhostDespawnSystem = World.GetOrCreateSystem <GhostDespawnSystem>(); RequireSingletonForUpdate <GhostPrefabCollectionComponent>(); m_ReceivedGhostVersion = new NativeArray <ulong>(1, Allocator.Persistent); m_GhostCompletionCount = new NativeArray <int>(2, Allocator.Persistent); }
protected override void OnCreate() { serializers = default(TGhostDeserializerCollection); m_ghostEntityMap = World.GetOrCreateSystem <GhostUpdateSystemGroup>().GhostEntityMap; playerGroup = GetEntityQuery( ComponentType.ReadWrite <NetworkStreamConnection>(), ComponentType.ReadOnly <NetworkStreamInGame>(), ComponentType.Exclude <NetworkStreamDisconnected>()); m_Barrier = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>(); m_CompressionModel = new NetworkCompressionModel(Allocator.Persistent); #if UNITY_EDITOR || DEVELOPMENT_BUILD m_NetStats = new NativeArray <uint>(serializers.Length * 3 + 3 + 1, Allocator.Persistent); m_StatsCollection = World.GetOrCreateSystem <GhostStatsCollectionSystem>(); #endif m_GhostDespawnSystem = World.GetOrCreateSystem <GhostDespawnSystem>(); serializers.Initialize(World); RequireSingletonForUpdate <GhostPrefabCollectionComponent>(); }