Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug ECS Crash in android. UnityEditor:2021.3.8f1; ECS+NetCode:0.51.1-preview.21;il2cpp

Discussion in 'Entity Component System' started by fgLxy, Nov 14, 2022.

  1. fgLxy

    fgLxy

    Joined:
    Feb 21, 2022
    Posts:
    12
    At the end of the battle, I call the dispose method of the client ECS World in the LateUpdate of MonoBehavior.
    Code (CSharp):
    1. private void LateUpdate()
    2. {
    3.     _commandInTick.Clear();
    4.     if (_destroyECSFlag)
    5.     {
    6.         var clearWorlds = new List<World>();
    7.         foreach (var world in World.All)
    8.         {
    9.             if (world.GetExistingSystem<ClientSimulationSystemGroup>() != null)
    10.             {
    11.                 clearWorlds.Add(world);
    12.             }
    13.         }
    14.         foreach (var world in clearWorlds)
    15.         {
    16.             world.Dispose();
    17.         }
    18.         _instance = null;
    19.         _destroyECSFlag = false;
    20.     }
    21. }
    Application crash when calling world.Dispose.The crash log is in the attachment tombstone_02.
    I tried to restore the stack with ida and il2cppdumper.
    Code (CSharp):
    1. ChunkDataUtility.DeallocateBuffers
    2. EntityComponentStore.Destroy(EntityComponentStore* entityComponentStore)
    3. EntityDataAccess.Dispose
    4. EntityManager.DestroyInstance
    5. WorldUnmanaged.Dispose
    6. World.Dispose
    This problem only occurs in il2cpp. Mono will not crash
     

    Attached Files:

  2. jeremygillespiecloutier

    jeremygillespiecloutier

    Joined:
    May 28, 2020
    Posts:
    5
    Did you find a solution to this problem?
     
  3. zhangdong304

    zhangdong304

    Joined:
    Mar 21, 2018
    Posts:
    23
  4. zhangdong304

    zhangdong304

    Joined:
    Mar 21, 2018
    Posts:
    23