public static void SampleWorld(World world) { ECSProfiler.EntitiesCount.Sample(world.GetEntitiesCount()); var sysCount = 0; for (int i = 0; i < world.systemGroups.Length; ++i) { var group = world.systemGroups[i]; if (group.runtimeSystem.allSystems == null) { continue; } sysCount += group.runtimeSystem.allSystems.Count; } ECSProfiler.SystemsCount.Sample(sysCount); ECSProfiler.ModulesCount.Sample(world.modules.Count); var viewModule = world.GetModule <ME.ECS.Views.IViewModule>(); if (viewModule != null) { var renderersCount = 0; var data = viewModule.GetData(); if (data.arr != null) { for (int i = 0; i < data.Length; ++i) { var views = data.arr[i]; renderersCount += views.Length; } } ECSProfiler.ViewsCount.Sample(renderersCount); } var netModule = world.GetModule <ME.ECS.Network.INetworkModuleBase>(); if (netModule != null) { ECSProfiler.NetworkEventsSentCount.Sample(netModule.GetEventsSentCount()); ECSProfiler.NetworkEventsReceivedCount.Sample(netModule.GetEventsReceivedCount()); ECSProfiler.NetworkEventsSentBytes.Sample(netModule.GetEventsBytesSentCount()); ECSProfiler.NetworkEventsReceivedBytes.Sample(netModule.GetEventsBytesReceivedCount()); } ECSProfiler.PoolUsed.Sample(PoolInternalBase.allocated - PoolInternalBase.deallocated); ECSProfiler.PoolAllocation.Value = PoolInternalBase.newAllocated - ECSProfiler.poolAllocationPrev; ECSProfiler.poolAllocationPrev = PoolInternalBase.newAllocated; }
public static ViewId RegisterViewSource <TProvider>(this World world, TProvider providerInitializer, UnityEngine.AddressableAssets.AssetReference prefab) where TProvider : struct, IViewsProviderInitializer { var viewsModule = world.GetModule <ViewsModule>(); return(viewsModule.RegisterViewSource(providerInitializer, prefab)); }