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 Large unity function executes instantly in editor, but stops responding in build

Discussion in 'Scripting' started by Tul_official, Aug 27, 2023.

  1. Tul_official

    Tul_official

    Joined:
    Jul 5, 2019
    Posts:
    2
    I have a large c# save function in my game which basically saves all save game data, which executes quickly in the editor, almost instantly, it used to work in builds but since I have reset player settings and I think that might be the reason why this is happening, but I cannot really say for sure when did it start happening.

    I am using IL2CPP, .NET standard 2.0, IL2CPP code generation is set to faster runtime and C++ compiler configuration is set to Release. I have tried setting C++ compiler configuration to Master, but the build gets stack on Linking gameAssembly.dylib and the only way for me to cancel that build is to force quit unity because it stops responding.

    Any help is appreciated!
     
    Last edited: Aug 27, 2023
  2. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,057
    Time to check the profiler then. What is taking so much time in a build which is not in the editor?
    Also we have no indication of how large your game is. Whether it is small, large, inefficient, super efficient,
    What ever your saving mechanism is etc. Details are important.
    But start off with the profiler. Check what is taking so much time.
    Perhaps some optimizations can be made

    Master takes significantly longer to build but you shouldn't rely on that configuration for your game to run smoothly.
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    Try making a debug & development build and attach the debugger with a breakpoint set in the method in question.
     
    Last edited: Aug 27, 2023
  4. dlorre

    dlorre

    Joined:
    Apr 12, 2020
    Posts:
    700
    Maybe a null reference somewhere? I've encountered issues where the error does not appear in console but the script stops.