Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Editor crashes every often after loading scene and running heavy code.

Discussion in 'Editor & General Support' started by Pixl8d1, Apr 29, 2024.

  1. Pixl8d1

    Pixl8d1

    Joined:
    Dec 2, 2022
    Posts:
    2
    I have set up a procedural level generation script that creates a bunch of complex meshes and then converts them into render textures for use as sprites. It also instantiates some other objects. In order to regenerate a level, I reload the scene (asynchronously).
    However, on loading/generating the scene, whether directly after pressing play or after moving onto the next level, it seems Unity has a chance of crashing (about 1/5). None of this seems to be an issue in build (for the small time tested).

    I have tried:
    - Converting function to coroutine and adding short delay between each heavy processing
    - Looking at crash logs but they are unhelpful - they just say Crash!! after running the generate function
    - Checking for recursion (although this usually freezes up rather than directly crashes) - there are no while loops in code, and I'm pretty sure the for loops are purely iterative.

    I am unaware if it corresponds to the seed given.

    Any ideas on what could be causing these infuriating crashes?

    Here is the crashlog, please let me know if you would like to see any code snippets (the whole level gen script is really long).
    Code (CSharp):
    1. Loaded scene 'Temp/Backupscenes/0.backup'
    2.     Deserialize:            6.583 ms
    3.     Integration:            72.009 ms
    4.     Integration of assets:  0.007 ms
    5.     Thread Wait Time:       0.005 ms
    6.     Total Operation Time:   78.603 ms
    7. Unloading 9 Unused Serialized files (Serialized files now loaded: 0)
    8. UnloadTime: 2.769800 ms
    9. Loaded scene 'Temp/Backupscenes/0.backup'
    10.     Deserialize:            3.084 ms
    11.     Integration:            34.254 ms
    12.     Integration of assets:  0.002 ms
    13.     Thread Wait Time:       5.835 ms
    14.     Total Operation Time:   43.175 ms
    15. Crash!!!
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,019
    The part following „Crash!!!“ would be most interesting. There is nothing following that? That would be unusual.

    You should add logging or use the debugger to check at which state in generating the editor tends to crash.

    Would also help if you shared some of the code. How heavy is heavy? Perhaps it‘s simply too much.
     
  3. Pixl8d1

    Pixl8d1

    Joined:
    Dec 2, 2022
    Posts:
    2
    Actually nevermind the issue appears to have fixed itself. Apologies for the inconvenience.