Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug GhostCollectionSystem is too slow

Discussion in 'NetCode for ECS' started by optimise, Jun 6, 2021.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    Hi @timjohansson @CMarastoni. I notice GhostCollectionSystem takes so long time execute when spawning ghost. It's unacceptable especially for mobile platform. At editor it's also crazy slow. It's even slow when in development build. I believe the main reason why it's so slow is caused by Entities lambda expression inside the system is not burst. Is there any plan to make it burst compatible and make it even faster at both release build and development build? And also maybe change DEVELOPMENT_BUILD scripting define symbol to something like NETCODE_DEVELOPMENT_BUILD so those slow codes are stripped out at development build by default.
     
    Last edited: Jun 6, 2021
  2. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    GhostCollectionSystem doesn't do much when a ghost is spawned, but it does do work when a new ghost prefab is loaded.
    How slow is slow and does it happen every time you spawn or just when you spawn a ghost type that has no been seen before? Do you have a profiler capture or numbers of how long it usually takes and how much it takes in the case you're hitting?
    We do not have many samples doing runtime loading of prefabs so it is not something we have seen or planned to work on at the moment, but if it is slow that sounds like something we would treat like a bug.

    We have move much of the logging code to a separate define which by default is editor or development build but can be explicitly disabled or enabled to override the default behavior. Not everything is moved to that define so it might not help.
    It should be very rare that you need to disable debug though, do you have a specific case where the validation is too slow so we can look at that?
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    Yes. It's really slow at Android development build.

    1.png

    Same at editor also really slow.

    upload_2021-6-7_15-23-0.png
     
  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    For what I see in your capture, is mostly (if not all) the GC the problem. If I remember correctly we fixed some GC pressure (that may solve that issue). There are still some allocation for strings (error names) that can be definitively reduced or removed (need some further work/investigation)
     
  5. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    From I what see the code guard with DEVELOPMENT_BUILD define still using OOP land C# data type. I think need to replace all of it to DOTS compatible data type and burst it.

    Actually another bottleneck is ProcessGhostPrefab function which also spend a lot of time. I think at least make ProcessGhostPrefab function burst compatible to solve performance issue.
     
    Last edited: Jun 7, 2021
  6. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    I investigate again and found this loading behavior also one the main reason that make GhostCollectionSystem so slow. Can u change it to only process ghost prefab that is actually spawned? Currently if I put 100 ghost prefabs into GhostCollectionAuthoringComponent and u only spawn 1 ghost from it you still pay the price for processing all the 100 ghost prefabs.
     
    Last edited: Jun 8, 2021
  7. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    We will surely investigate that processing and trying to make it faster. But handing only the spawned ones is a little more problematic (even if it makes completely sense btw) and need some careful considerations.
    Processing these prefabs is necessary for being able to detect if the client is compatible with the server is trying to connect to in the first place.
    Another thing that make it tricky is that the client must process the prefab before receive the ghost data from the server, otherwise it will not be able to deserialize the ghosts. Making that initialization "lazy", may end introducing some extra latency to spawn entities on the client (at least the first time a new ghost is spawned).

    That being said, it is something we will sure consider in the analysis.
     
    optimise likes this.
  8. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    Btw can I get unofficial fix for this huge GC spike first?
     
  9. timjohansson

    timjohansson

    Unity Technologies

    Joined:
    Jul 13, 2016
    Posts:
    473
    I don't have a repro for that spike at hand so I can't reliably test it. I have spotted some code which does a significant amount of gc allocations though. Removing them completely is a fairly large change, but I think we can reduce it significantly.
    I can't promise it will fix the issue, but if you want to help us try something out it would be great if you can move netcode to the Packages folder so you can change it, open GhostCollectionSystem.cs and change

    Code (CSharp):
    1.                     var errorNames = compState.PredictionErrorNames.ToString().Split(',');
    2.                     for (int name = 0; name < errorNames.Length; ++name)
    3.                     {
    4.                         if (ghostChildIndex == 0)
    5.                             errorNames[name] = $"{ghostMeta.Name.ToString()}.{compState.ComponentType}.{errorNames[name]}";
    6.                         else
    7.                             errorNames[name] = $"{ghostMeta.Name.ToString()}[{ghostChildIndex}].{compState.ComponentType}.{errorNames[name]}";
    8.                     }
    9.                     m_PredictionErrorNames.AddRange(errorNames);
    10.  
    to

    Code (CSharp):
    1.                     unsafe
    2.                     {
    3.                     int strStart = 0;
    4.                     int strEnd = 0;
    5.                     int strLen = compState.PredictionErrorNames.Length;
    6.                     string ghostName = ghostMeta.Name.ToString();
    7.                     FixedString512 errorName = default;
    8.                     while (strStart < strLen)
    9.                     {
    10.                         strEnd = strStart;
    11.                         while (strEnd < strLen && compState.PredictionErrorNames[strEnd] != ',')
    12.                             ++strEnd;
    13.                         errorName = ghostName;
    14.                         if (ghostChildIndex != 0)
    15.                         {
    16.                             errorName.Append('[');
    17.                             errorName.Append(ghostChildIndex);
    18.                             errorName.Append(']');
    19.                         }
    20.                         errorName.Append('.');
    21.                         errorName.Append(TypeManager.GetTypeInfo(compState.ComponentType.TypeIndex).DebugTypeName);
    22.                         errorName.Append('.');
    23.                         errorName.Append(compState.PredictionErrorNames.GetUnsafePtr() + strStart, strEnd-strStart);
    24.                         m_PredictionErrorNames.Add(errorName.ToString());
    25.                         // Skip the ,
    26.                         strStart = strEnd + 1;
    27.                     }
    28.                     }
    29.  
     
  10. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    Alright. Tried just now. Still same huge GC spike.
     
  11. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    I would like to understand how it work currently at Netcode 0.6.0-preview.7. Is that possible that I load like 8 ghost prefab entity to spawn 8 ghost entity and later load another like 10 ghost prefab entity and spawn 5 ghost entity from among that 10 ghost prefab entity?
     
  12. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    Hi @timjohansson Have u figured out new fix for this issue?

    Hi @CMarastoni Can I confirm this with u again? From my understanding, GhostCollectionSystem at both client and server will find and process ghost prefab every frame. So, as long as I make ghost prefab entity that I want to
    instantiate available at both client and server first at any point of time then I can instantiate it. Even I make the ghost prefab available at late time it's still ok right?
     
  13. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni I relook at this issue again. It's just like what you say the slowdown mainly cause by insane GC spike that comes from all the code that guard by UNITY_EDITOR || DEVELOPMENT_BUILD define in GhostCollectionSystem.
    Can you roll out unofficial fix for this issue? For now it should be fix most of the performance issue for me. At least at editor. Currently it's stuck like over 15+ seconds when I enter play mode at editor.
     
    Last edited: Jul 6, 2021
  14. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    So we have changes for that. Not sure if they will fix the GC spikes completely but should reduced them.
    One is inside the GhostCollectionSystem, that @timjohansson already posted here and the other ones is larger and it is inside the GhostStatsCollectionSystem.cs and DebugWebSocket.cs

    I will link the files here. Please try it out to see if that alleviate the problem for you. They should be completely compatible with 0.6-preview.7
     

    Attached Files:

  15. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni I get NativeText could not found error.
    Library\PackageCache\com.unity.netcode@34e1347be5\Runtime\Stats\GhostStatsCollectionSystem.cs(67,17): error CS0246: The type or namespace name 'NativeText' could not be found (are you missing a using directive or an assembly reference?)
     
  16. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    Oh yeah, that api has changed. I think you can use the HeapString instead.
     
    optimise likes this.
  17. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Come out another 4 errors. I think there is lot of missing code at GhostCollectionSystem. Can you send me new GhostCollectionSystem code?

    Library\PackageCache\com.unity.netcode@35a52ae784\Runtime\Snapshot\GhostCollectionSystem.cs(247,89): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.List<string>' to 'Unity.Collections.NativeList<Unity.Collections.FixedString128>'

    Library\PackageCache\com.unity.netcode@35a52ae784\Runtime\Snapshot\GhostCollectionSystem.cs(247,103): error CS1503: Argument 2: cannot convert from 'System.Collections.Generic.List<string>' to 'Unity.Collections.NativeList<Unity.Collections.FixedString512>'

    Library\PackageCache\com.unity.netcode@35a52ae784\Runtime\Snapshot\GhostCollectionSystem.cs(357,85): error CS1503: Argument 1: cannot convert from 'System.Collections.Generic.List<string>' to 'Unity.Collections.NativeList<Unity.Collections.FixedString128>'

    Library\PackageCache\com.unity.netcode@35a52ae784\Runtime\Snapshot\GhostCollectionSystem.cs(357,99): error CS1503: Argument 2: cannot convert from 'System.Collections.Generic.List<string>' to 'Unity.Collections.NativeList<Unity.Collections.FixedString512>'
     
    Last edited: Jul 6, 2021
  18. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    You should adapt your ghost collection system a little:

    OnCreate:
    #if UNITY_EDITOR || DEVELOPMENT_BUILD
    m_PredictionErrorNames = new NativeList<FixedString512>(16, Allocator.Persistent);
    m_GhostNames = new NativeList<FixedString128>(16, Allocator.Persistent);
    #endif

    OnDestroy:
    #if UNITY_EDITOR || DEVELOPMENT_BUILD
    m_PredictionErrorNames.Dispose();
    m_GhostNames.Dispose();
    #endif

    OnUpdate:
    #if UNITY_EDITOR || DEVELOPMENT_BUILD
    if (m_PrevPredictionErrorNamesCount < m_PredictionErrorNames.Length || m_PrevGhostNamesCount < m_GhostNames.Length)
    {
    World.GetExistingSystem<GhostStatsCollectionSystem>().SetGhostNames(m_GhostNames, m_PredictionErrorNames);
    m_PrevPredictionErrorNamesCount = m_PredictionErrorNames.Length;
    m_PrevGhostNamesCount = m_GhostNames.Length;
    }
    #endif
     
  19. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Editor just crash when I enter play mode. Are m_PredictionErrorNames and m_GhostNames not allocate large enough to use? But weird since it's NativeList it should able to expand the size itself.

    Edit: Test with very simple Netcode that has only 1 ghost also crash. There's somewhere make it crash but I'm not sure it's actually at where but get the editor crash log.

    Stacktrace:
    at <unknown> <0xffffffff>
    at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility.Free (void*,Unity.Collections.Allocator) [0x00008] in <24599fe2776145d58ab771516c063d56>:0
    at Unity.Collections.Memory/Unmanaged/Array.Resize (void*,long,long,Unity.Collections.Allocator,long,int) [0x0004d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\Memory.cs:84
    at Unity.Collections.Memory/Unmanaged.Free (void*,Unity.Collections.Allocator) [0x00006] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\Memory.cs:25
    at Unity.Collections.AllocatorManager.TryLegacy (Unity.Collections.AllocatorManager/Block&) [0x00081] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:437
    at Unity.Collections.AllocatorManager.Try (Unity.Collections.AllocatorManager/Block&) [0x0001c] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:456
    at Unity.Collections.AllocatorManager.Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*,int,int,int) [0x0004f] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:74
    at Unity.Collections.AllocatorManager.Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*) [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:85
    at Unity.Collections.LowLevel.Unsafe.UnsafeList.Dispose () [0x0000d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\UnsafeList.cs:198
    at Unity.Collections.LowLevel.Unsafe.UnsafeList.Destroy (Unity.Collections.LowLevel.Unsafe.UnsafeList*) [0x0000c] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\UnsafeList.cs:166
    at Unity.Collections.NativeList`1<byte>.Dispose () [0x00011] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\NativeList.cs:433
    at Unity.Collections.HeapString.Dispose () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\HeapString.gen.cs:211
    at Unity.NetCode.GhostStatsCollectionSystem.OnDestroy () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.netcode@9980e7196a\Runtime\Stats\GhostStatsCollectionSystem.cs:183
    at Unity.Entities.ComponentSystemBase.OnDestroy_Internal () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\ComponentSystemBase.cs:198
    at Unity.Entities.World.DestroyAllSystemsAndLogException () [0x0004d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:413
    at Unity.Entities.World.Dispose () [0x00031] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:156
    at Unity.Entities.World.DisposeAllWorlds () [0x00002] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:174
    at Unity.Entities.DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown () [0x00048] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\DefaultWorldInitialization.cs:94
    at Unity.Entities.DefaultWorldInitializationProxy.OnDisable () [0x00008] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\DefaultWorldInitializationProxy.cs:29
    at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================
    Received signal SIGSEGV
    Stack trace:
    0x00007ff76e0062f9 (Unity) MemoryProfiler::UnregisterAllocation
    0x00007ff76d7998eb (Unity) MemoryManager::RegisterDeallocation
    0x00007ff76d795c56 (Unity) MemoryManager::Deallocate
    0x00007ff76d7a7b8a (Unity) free_alloc_internal
    0x00007ff76e9fe915 (Unity) UnsafeUtility::Free
    0x00007ff76e8918e3 (Unity) UnsafeUtility_CUSTOM_Free
    0x00000174fae5fbad (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:Free (void*,Unity.Collections.Allocator)
    0x00000174fac42cd3 (Mono JIT Code) [Memory.cs:85] Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.Allocator,long,int)
    0x00000174fae5fb0b (Mono JIT Code) [Memory.cs:26] Unity.Collections.Memory/Unmanaged:Free (void*,Unity.Collections.Allocator)
    0x00000174fac4545b (Mono JIT Code) [AllocatorManager.cs:438] Unity.Collections.AllocatorManager:TryLegacy (Unity.Collections.AllocatorManager/Block&)
    0x00000174fac45253 (Mono JIT Code) [AllocatorManager.cs:456] Unity.Collections.AllocatorManager:Try (Unity.Collections.AllocatorManager/Block&)
    0x00000174fac458fb (Mono JIT Code) [AllocatorManager.cs:74] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*,int,int,int)
    0x00000174fac4580b (Mono JIT Code) [AllocatorManager.cs:86] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*)
    0x00000174fe2ad8db (Mono JIT Code) [UnsafeList.cs:199] Unity.Collections.LowLevel.Unsafe.UnsafeList:Dispose ()
    0x00000174fe2ad7eb (Mono JIT Code) [UnsafeList.cs:167] Unity.Collections.LowLevel.Unsafe.UnsafeList:Destroy (Unity.Collections.LowLevel.Unsafe.UnsafeList*)
    0x00000175c2fa10fb (Mono JIT Code) [NativeList.cs:434] Unity.Collections.NativeList`1<byte>:Dispose ()
    0x00000175c2fa107b (Mono JIT Code) [HeapString.gen.cs:212] Unity.Collections.HeapString:Dispose ()
    0x00000175c2fa0e8b (Mono JIT Code) [GhostStatsCollectionSystem.cs:184] Unity.NetCode.GhostStatsCollectionSystem:OnDestroy ()
    0x00000175ccdb3655 (Mono JIT Code) [ComponentSystemBase.cs:199] Unity.Entities.ComponentSystemBase:OnDestroy_Internal ()
    0x00000175ccdb3243 (Mono JIT Code) [World.cs:414] Unity.Entities.World:DestroyAllSystemsAndLogException ()
    0x00000175ccdb2a73 (Mono JIT Code) [World.cs:157] Unity.Entities.World:Dispose ()
    0x00000175ccdb296b (Mono JIT Code) [World.cs:172] Unity.Entities.World:DisposeAllWorlds ()
    0x00000175ccdb22fb (Mono JIT Code) [DefaultWorldInitialization.cs:96] Unity.Entities.DefaultWorldInitialization:DomainUnloadOrPlayModeChangeShutdown ()
    0x0000017521ae522b (Mono JIT Code) [DefaultWorldInitializationProxy.cs:30] Unity.Entities.DefaultWorldInitializationProxy:OnDisable ()
    0x00000175ccfa8e10 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007ff92e68e630 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    0x00007ff92e612ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    0x00007ff92e61bb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    0x00007ff76e6c9464 (Unity) scripting_method_invoke
    0x00007ff76e6c1db5 (Unity) ScriptingInvocation::Invoke
    0x00007ff76e6c21de (Unity) ScriptingInvocation::InvokeChecked
    0x00007ff76e72ed06 (Unity) SerializableManagedRef::CallMethod
    0x00007ff76e67897a (Unity) MonoBehaviour::RemoveFromManager
    0x00007ff76d841558 (Unity) GameObject::ActivateAwakeRecursivelyInternal
    0x00007ff76d841169 (Unity) GameObject::ActivateAwakeRecursively
    0x00007ff76d843d69 (Unity) GameObject::Deactivate
    0x00007ff76df7272e (Unity) DestroyObjectHighLevel_Internal
    0x00007ff76df72354 (Unity) DestroyObjectHighLevel
    0x00007ff76df80a17 (Unity) DestroyWorldObjects
    0x00007ff76fa1bb5b (Unity) EditorSceneManager::RestoreSceneBackups
    0x00007ff76f3bf1bd (Unity) PlayerLoopController::ExitPlayMode
    0x00007ff76f3d4527 (Unity) PlayerLoopController::SetIsPlaying
    0x00007ff76f3d7284 (Unity) Application::TickTimer
    0x00007ff76fd4ff81 (Unity) MainMessageLoop
    0x00007ff76fd53fc1 (Unity) WinMain
    0x00007ff771b89526 (Unity) __scrt_common_main_seh
    0x00007ff9ae2b7034 (KERNEL32) BaseThreadInitThunk
    0x00007ff9afe62651 (ntdll) RtlUserThreadStart
    ate () [0x0005f] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystem.cs:114
    at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x000c7] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:472
    at Unity.Entities.ComponentSystemGroup.OnUpdate () [0x0000e] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:417
    at Unity.NetCode.ServerSimulationSystemGroup.OnUpdate () [0x000b7] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.netcode@9980e7196a\Runtime\ClientServerWorld\ServerSimulationSystemGroup.cs:75
    at Unity.Entities.ComponentSystem.Update () [0x0005f] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystem.cs:114
    at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x000c7] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:472
    at Unity.Entities.ComponentSystemGroup.OnUpdate () [0x0000e] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:417
    at Unity.Entities.ComponentSystem.Update () [0x0005f] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystem.cs:114
    at Unity.Entities.ComponentSystemGroup.UpdateAllSystems () [0x000c7] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:472
    at Unity.Entities.ComponentSystemGroup.OnUpdate () [0x0000e] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystemGroup.cs:417
    at Unity.Entities.ComponentSystem.Update () [0x0005f] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ComponentSystem.cs:114
    at Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper.TriggerUpdate () [0x0000f] in C:\Users\Lim.DESKTOP-F47HO5G\Documents\UnityProject\botr\Library\PackageCache\com.unity.entities@bfeb4734bd\Unity.Entities\ScriptBehaviourUpdateOrder.cs:333
    at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================
    Received signal SIGSEGV
    Stack trace:
    0x00007ff76e0062f9 (Unity) MemoryProfiler::UnregisterAllocation
    0x00007ff76d7998eb (Unity) MemoryManager::RegisterDeallocation
    0x00007ff76d795c56 (Unity) MemoryManager::Deallocate
    0x00007ff76d7a7b8a (Unity) free_alloc_internal
    0x00007ff76e9fe915 (Unity) UnsafeUtility::Free
    0x00007ff76e8918e3 (Unity) UnsafeUtility_CUSTOM_Free
    0x0000020dd3e7fa0d (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:Free (void*,Unity.Collections.Allocator)
    0x0000020dd2dfd6a3 (Mono JIT Code) [Memory.cs:85] Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.Allocator,long,int)
    0x0000020dd3e7f96b (Mono JIT Code) [Memory.cs:26] Unity.Collections.Memory/Unmanaged:Free (void*,Unity.Collections.Allocator)
    0x0000020dd2dff47b (Mono JIT Code) [AllocatorManager.cs:438] Unity.Collections.AllocatorManager:TryLegacy (Unity.Collections.AllocatorManager/Block&)
    0x0000020dd2dff273 (Mono JIT Code) [AllocatorManager.cs:456] Unity.Collections.AllocatorManager:Try (Unity.Collections.AllocatorManager/Block&)
    0x0000020dd2dff91b (Mono JIT Code) [AllocatorManager.cs:74] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*,int,int,int)
    0x0000020dd2dff82b (Mono JIT Code) [AllocatorManager.cs:86] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*)
    0x0000020dd2dff703 (Mono JIT Code) [UnsafeList.cs:303] Unity.Collections.LowLevel.Unsafe.UnsafeList:Realloc (int,int,int)
    0x0000020dd2dff5fb (Mono JIT Code) [UnsafeList.cs:319] Unity.Collections.LowLevel.Unsafe.UnsafeList:SetCapacity (int,int,int)
    0x0000020dd3e7f77b (Mono JIT Code) [UnsafeList.cs:261] Unity.Collections.LowLevel.Unsafe.UnsafeList:Resize (int,int,int,Unity.Collections.NativeArrayOptions)
    0x0000020e5b03c40b (Mono JIT Code) [NativeList.cs:701] Unity.Collections.NativeList`1<byte>:Resize (int,Unity.Collections.NativeArrayOptions)
    0x0000020e5b057c43 (Mono JIT Code) [HeapString.gen.cs:71] Unity.Collections.HeapString:set_Length (int)
    0x0000020e5bbfb803 (Mono JIT Code) [HeapString.gen.cs:99] Unity.Collections.HeapString:TryResize (int,Unity.Collections.NativeArrayOptions)
    0x0000020e5bbfb6ab (Mono JIT Code) [FixedStringAppendMethods.cs:326] Unity.Collections.FixedStringMethods:Append<Unity.Collections.HeapString> (Unity.Collections.HeapString&,byte*,int)
    0x0000020e5bbfc183 (Mono JIT Code) [FixedStringAppendMethods.cs:290] Unity.Collections.FixedStringMethods:Append<Unity.Collections.HeapString, Unity.Collections.FixedString512> (Unity.Collections.HeapString&,Unity.Collections.FixedString512&)
    0x0000020e5bbfae53 (Mono JIT Code) [GhostStatsCollectionSystem.cs:96] Unity.NetCode.GhostStatsCollectionSystem:SetGhostNames (Unity.Collections.NativeList`1<Unity.Collections.FixedString128>,Unity.Collections.NativeList`1<Unity.Collections.FixedString512>)
    0x0000020e5b2548eb (Mono JIT Code) [GhostCollectionSystem.cs:362] Unity.NetCode.GhostCollectionSystem:OnUpdate ()
    0x0000020e6402d7ef (Mono JIT Code) [SystemBase.cs:401] Unity.Entities.SystemBase:Update ()
    0x0000020e6402a098 (Mono JIT Code) [ComponentSystemGroup.cs:474] Unity.Entities.ComponentSystemGroup:UpdateAllSystems ()
    0x0000020e64029af3 (Mono JIT Code) [ComponentSystemGroup.cs:418] Unity.Entities.ComponentSystemGroup:OnUpdate ()
    0x0000020e64028cfe (Mono JIT Code) [ComponentSystem.cs:115] Unity.Entities.ComponentSystem:Update ()
    0x0000020e6402a098 (Mono JIT Code) [ComponentSystemGroup.cs:474] Unity.Entities.ComponentSystemGroup:UpdateAllSystems ()
    0x0000020e64029af3 (Mono JIT Code) [ComponentSystemGroup.cs:418] Unity.Entities.ComponentSystemGroup:OnUpdate ()
    0x0000020e5b228b73 (Mono JIT Code) [ServerSimulationSystemGroup.cs:76] Unity.NetCode.ServerSimulationSystemGroup:OnUpdate ()
    0x0000020e64028cfe (Mono JIT Code) [ComponentSystem.cs:115] Unity.Entities.ComponentSystem:Update ()
    0x0000020e6402a098 (Mono JIT Code) [ComponentSystemGroup.cs:474] Unity.Entities.ComponentSystemGroup:UpdateAllSystems ()
    0x0000020e64029af3 (Mono JIT Code) [ComponentSystemGroup.cs:418] Unity.Entities.ComponentSystemGroup:OnUpdate ()
    0x0000020e64028cfe (Mono JIT Code) [ComponentSystem.cs:115] Unity.Entities.ComponentSystem:Update ()
    0x0000020e6402a098 (Mono JIT Code) [ComponentSystemGroup.cs:474] Unity.Entities.ComponentSystemGroup:UpdateAllSystems ()
    0x0000020e64029af3 (Mono JIT Code) [ComponentSystemGroup.cs:418] Unity.Entities.ComponentSystemGroup:OnUpdate ()
    0x0000020e64028cfe (Mono JIT Code) [ComponentSystem.cs:115] Unity.Entities.ComponentSystem:Update ()
    0x0000020e64028aed (Mono JIT Code) [ScriptBehaviourUpdateOrder.cs:335] Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate ()
    0x0000020daad1d4a0 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007ff92e68e630 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    0x00007ff92e612ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    0x00007ff92e61bb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    0x00007ff76e6c9464 (Unity) scripting_method_invoke
    0x00007ff76e6c1db5 (Unity) ScriptingInvocation::Invoke
    0x00007ff76df8c4a5 (Unity) ExecutePlayerLoop
    0x00007ff76df8c4c3 (Unity) ExecutePlayerLoop
    0x00007ff76df932f9 (Unity) PlayerLoop
    0x00007ff76f3d9381 (Unity) PlayerLoopController::UpdateScene
    0x00007ff76f3d7016 (Unity) Application::TickTimer
    0x00007ff76fd4ff81 (Unity) MainMessageLoop
    0x00007ff76fd53fc1 (Unity) WinMain
    0x00007ff771b89526 (Unity) __scrt_common_main_seh
    0x00007ff9ae2b7034 (KERNEL32) BaseThreadInitThunk
    0x00007ff9afe62651 (ntdll) RtlUserThreadStart
     
    Last edited: Jul 6, 2021
  20. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    Using your version it just crash as soon as the string get resized. Is very low level (like the allocator is corrupted)). I'll check later. As work around, could you please try to allocate an insane large string buffer, like 4MB? so no need to resize probably.
    Is just a test to verify the GC spike.
     
    Last edited: Jul 6, 2021
  21. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Sadly it's still crash. Looks like it's same crash log. Btw I set m_PredictionErrorNames and m_GhostNames NativeList initial capacity to 4096 should be 4MB right?

    Edit: Oh yeah. Is that engine level bug? Seem like the API is calling C++ engine side API.

    Stacktrace:
    at <unknown> <0xffffffff>
    at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility.Free (void*,Unity.Collections.Allocator) [0x00008] in <24599fe2776145d58ab771516c063d56>:0
    at Unity.Collections.Memory/Unmanaged/Array.Resize (void*,long,long,Unity.Collections.Allocator,long,int) [0x0004d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\Memory.cs:84
    at Unity.Collections.Memory/Unmanaged.Free (void*,Unity.Collections.Allocator) [0x00006] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\Memory.cs:25
    at Unity.Collections.AllocatorManager.TryLegacy (Unity.Collections.AllocatorManager/Block&) [0x00081] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:437
    at Unity.Collections.AllocatorManager.Try (Unity.Collections.AllocatorManager/Block&) [0x0001c] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:456
    at Unity.Collections.AllocatorManager.Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*,int,int,int) [0x0004f] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:74
    at Unity.Collections.AllocatorManager.Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*) [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\AllocatorManager.cs:85
    at Unity.Collections.LowLevel.Unsafe.UnsafeList.Dispose () [0x0000d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\UnsafeList.cs:198
    at Unity.Collections.LowLevel.Unsafe.UnsafeList.Destroy (Unity.Collections.LowLevel.Unsafe.UnsafeList*) [0x0000c] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\UnsafeList.cs:166
    at Unity.Collections.NativeList`1<byte>.Dispose () [0x00011] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\NativeList.cs:433
    at Unity.Collections.HeapString.Dispose () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.collections@0.15.0-preview.21\Unity.Collections\HeapString.gen.cs:211
    at Unity.NetCode.GhostStatsCollectionSystem.OnDestroy () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.netcode@a2d5c8dd14\Runtime\Stats\GhostStatsCollectionSystem.cs:183
    at Unity.Entities.ComponentSystemBase.OnDestroy_Internal () [0x00000] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\ComponentSystemBase.cs:198
    at Unity.Entities.World.DestroyAllSystemsAndLogException () [0x0004d] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:413
    at Unity.Entities.World.Dispose () [0x00031] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:156
    at Unity.Entities.World.DisposeAllWorlds () [0x00002] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\World.cs:174
    at Unity.Entities.DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown () [0x00048] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\DefaultWorldInitialization.cs:94
    at Unity.Entities.DefaultWorldInitializationProxy.OnDisable () [0x00008] in C:\UnitySample\gameplayservertest\Library\PackageCache\com.unity.entities@5e423522e5\Unity.Entities\DefaultWorldInitializationProxy.cs:29
    at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================
    Received signal SIGSEGV
    Stack trace:
    0x00007ff76e0062f9 (Unity) MemoryProfiler::UnregisterAllocation
    0x00007ff76d7998eb (Unity) MemoryManager::RegisterDeallocation
    0x00007ff76d795c56 (Unity) MemoryManager::Deallocate
    0x00007ff76d7a7b8a (Unity) free_alloc_internal
    0x00007ff76e9fe915 (Unity) UnsafeUtility::Free
    0x00007ff76e8918e3 (Unity) UnsafeUtility_CUSTOM_Free
    0x000001aa49dba24d (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:Free (void*,Unity.Collections.Allocator)
    0x000001aa49d9b173 (Mono JIT Code) [Memory.cs:85] Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.Allocator,long,int)
    0x000001aa49dba1ab (Mono JIT Code) [Memory.cs:26] Unity.Collections.Memory/Unmanaged:Free (void*,Unity.Collections.Allocator)
    0x000001aa49d9dd7b (Mono JIT Code) [AllocatorManager.cs:438] Unity.Collections.AllocatorManager:TryLegacy (Unity.Collections.AllocatorManager/Block&)
    0x000001aa49d9db33 (Mono JIT Code) [AllocatorManager.cs:456] Unity.Collections.AllocatorManager:Try (Unity.Collections.AllocatorManager/Block&)
    0x000001aa49d9e2fb (Mono JIT Code) [AllocatorManager.cs:74] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*,int,int,int)
    0x000001aa49d9e1eb (Mono JIT Code) [AllocatorManager.cs:86] Unity.Collections.AllocatorManager:Free (Unity.Collections.AllocatorManager/AllocatorHandle,void*)
    0x000001a983897eeb (Mono JIT Code) [UnsafeList.cs:199] Unity.Collections.LowLevel.Unsafe.UnsafeList:Dispose ()
    0x000001a983897dfb (Mono JIT Code) [UnsafeList.cs:167] Unity.Collections.LowLevel.Unsafe.UnsafeList:Destroy (Unity.Collections.LowLevel.Unsafe.UnsafeList*)
    0x000001a98f003aab (Mono JIT Code) [NativeList.cs:434] Unity.Collections.NativeList`1<byte>:Dispose ()
    0x000001a98f003a4b (Mono JIT Code) [HeapString.gen.cs:212] Unity.Collections.HeapString:Dispose ()
    0x000001a98f0038cb (Mono JIT Code) [GhostStatsCollectionSystem.cs:184] Unity.NetCode.GhostStatsCollectionSystem:OnDestroy ()
    0x000001a98de6ead5 (Mono JIT Code) [ComponentSystemBase.cs:199] Unity.Entities.ComponentSystemBase:OnDestroy_Internal ()
    0x000001a98de6e703 (Mono JIT Code) [World.cs:414] Unity.Entities.World:DestroyAllSystemsAndLogException ()
    0x000001a98de6e063 (Mono JIT Code) [World.cs:157] Unity.Entities.World:Dispose ()
    0x000001a98de6df5b (Mono JIT Code) [World.cs:172] Unity.Entities.World:DisposeAllWorlds ()
    0x000001a98de6d9ab (Mono JIT Code) [DefaultWorldInitialization.cs:96] Unity.Entities.DefaultWorldInitialization:DomainUnloadOrPlayModeChangeShutdown ()
    0x000001a98da04a1b (Mono JIT Code) [DefaultWorldInitializationProxy.cs:30] Unity.Entities.DefaultWorldInitializationProxy:OnDisable ()
    0x000001aa49c8d4e0 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007ff92e68e630 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    0x00007ff92e612ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    0x00007ff92e61bb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    0x00007ff76e6c9464 (Unity) scripting_method_invoke
    0x00007ff76e6c1db5 (Unity) ScriptingInvocation::Invoke
    0x00007ff76e6c21de (Unity) ScriptingInvocation::InvokeChecked
    0x00007ff76e72ed06 (Unity) SerializableManagedRef::CallMethod
    0x00007ff76e67897a (Unity) MonoBehaviour::RemoveFromManager
    0x00007ff76d841558 (Unity) GameObject::ActivateAwakeRecursivelyInternal
    0x00007ff76d841169 (Unity) GameObject::ActivateAwakeRecursively
    0x00007ff76d843d69 (Unity) GameObject::Deactivate
    0x00007ff76df7272e (Unity) DestroyObjectHighLevel_Internal
    0x00007ff76df72354 (Unity) DestroyObjectHighLevel
    0x00007ff76df80a17 (Unity) DestroyWorldObjects
    0x00007ff76fa1bb5b (Unity) EditorSceneManager::RestoreSceneBackups
    0x00007ff76f3bf1bd (Unity) PlayerLoopController::ExitPlayMode
    0x00007ff76f3d4527 (Unity) PlayerLoopController::SetIsPlaying
    0x00007ff76f3d7284 (Unity) Application::TickTimer
    0x00007ff76fd4ff81 (Unity) MainMessageLoop
    0x00007ff76fd53fc1 (Unity) WinMain
    0x00007ff771b89526 (Unity) __scrt_common_main_seh
    0x00007ff9ae2b7034 (KERNEL32) BaseThreadInitThunk
    0x00007ff9afe62651 (ntdll) RtlUserThreadStart
     
  22. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    so the bug fix is (long story...) is to change this line in the GhostStatsCollectionSystem

    instead of
    m_LastNameAndErrorArray.Clear()
    do:
    m_LastNameAndErrorArray.TryResize(0);

    and that should work
     
  23. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Awesome. Working now. Thanks a lot.
     
  24. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    Can you give me some performance metrics in regards the GC spike now ? for sake of comparison
     
  25. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni At editor enter play mode is still instant. I will try Android development build later.
     
    Last edited: Jul 7, 2021
  26. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni For Android development build now the load time looks like it's also almost the same as Android release build. It's quantum leap performance improvement but I still spot some GC. I think the next thing to do is to make the whole GhostCollectionSystem code burst as much as possible specially starting from the
    Perform runtime stripping of all prefabs which need it code that has ProcessGhostPrefab method which is expensive. I believe it should fully eliminate GC. Also I think for all the future development for debugging code also need to use dots compatible data type and burst it by default.

    Before


    After
    upload_2021-7-7_15-54-14.png
     

    Attached Files:

    Last edited: Jul 7, 2021
  27. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    I see. There are still some GC that I'm sure we can further reduce (I think we also had some improvement in that regard).
    We have plans for further optimization passes on the GhostCollectionSystem in general in the future.
     
    optimise likes this.
  28. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni One more thing I would like to ask. Can I expect next Netcode version will port most of class based systems to struct based system i.e. fully burst whole system? Currently I notice class based system is too slow at mobile phone specially mid range and low range specifications.

    And also is there any plan to further improve the performance of Entities class based system that codegen even better performance code? Long time ago I use 3rd party ECS system that it also updates class based system in batch based on MonoBehavior as entry point and it's still significant faster than current Entities class based system. The performance is not really acceptable and I think Entities class based system needs improvement.
     
  29. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    The next version for sure not.
    We plan to investigate the use unmanaged systems later, but I don't have a concrete timeline yet to share.
     
    optimise likes this.
  30. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Today I only realize that there's one more insanely slow system that I always disable it called GhostPredictionDebugSystem. Do u have unofficial fix for GhostPredictionDebugSystem?

    upload_2021-7-12_1-2-38.png
     
  31. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    I think has been reported also by someone else that GhostPredictionDebugSystem was slow in some situation (I think @timjohansson answered to that).
    We recently made some optimisation to it that greatly reduce the load (by using parallel jobs)
    In your case, IIRC you have something like 5000 or more fields in total (or something like that) that make it a worthy case scenario in term of stress to the system.
    There is at the moment no plans to back port to 0.6-preview.7 (at least that I know). I would make no promises for any un-official fix :)
     
    optimise likes this.
  32. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni I wonder what is that 5000 or more fields in total? I'm not aware of that. lol
     
    Last edited: Jul 12, 2021
  33. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    941
    That was/is the total number of serialized fields present in all your ghost components in your project (probably they were even more) I saw last time when I was digging into the crash in the netdbg tool
    :)
     
  34. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,133
    @CMarastoni Btw for total number of serialized fields present in all your ghost components in your project, do u mean even the component that is not marked as GhostField attribute also counted as 1 as long as the component is as part of ghost? Or the total number of serialized fields present in all your ghost components actually means the count of total of number of GhostField attribute marked for all the components?
     
    Last edited: Jul 13, 2021