Search Unity

Unity crashes every time I save in VS2019

Discussion in 'Scripting' started by henleybailey, Dec 14, 2019.

  1. henleybailey

    henleybailey

    Joined:
    Dec 14, 2019
    Posts:
    3
    Hi, I'm finding that Unity crashes 100% of the time when I save in VS2019. This happens when the game is running within Unity. If I stop the game in Unity, switch to VS2019 and save, then go back and hit play again - all is fine. Something to do with the live recompile seems to crash Unity.

    I've only just started with Unity and the project is extremely basic, what could the issue be or how can I figure out what's going on? Does Unity spit out error logs anywhere?
     
    Last edited: Dec 16, 2019
  2. henleybailey

    henleybailey

    Joined:
    Dec 14, 2019
    Posts:
    3
    For anyone else having this issue, I submitted a bug and the Unity guys mentioned it looks to be something with the Oculus hand controller (I have the Oculus VR integration plugin), so is something that Oculus will probably need to tweak. Hopefully it will magically fix itself after an update of two. I'm running version 2019.3
     
  3. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    I know from the past, Unity don't like saving scripts when at runtime. But in my case, it was typical returning errors in console. However, since then I don't save scripts when at runtime.

    If I have to, I modify scripts, then stop runtime and save then. Sure not ideal, but at least no worrying about errors, or crashes at runtime.
     
  4. henleybailey

    henleybailey

    Joined:
    Dec 14, 2019
    Posts:
    3
    That's what I've ended up doing, having to remember to stop before making any code changes. Catches me out a lot but at least it's workable. Makes workflow slower though but it's not the end of the world.
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    Have you tried changing the Script changes while playing to "Stop playing and recompile" or "Recompile after finished playing"?
     

    Attached Files:

    Antypodish and Joe-Censored like this.
  6. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    Oh that looks very useful. I am learning something new :)
     
  7. orian_ptt

    orian_ptt

    Joined:
    Dec 26, 2019
    Posts:
    1
    We are now in July 2020 and the bug if it is the same is still present. I'm using 2019.3.15f1 and Oculus Integration. every time I save one of the script while running the Unity editor crash consistently
     
  8. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Same for me. Especially if you are using collaborate and with each start Unity scans for changes in the project which takes a while.
     
  9. dr3d

    dr3d

    Joined:
    Jan 23, 2008
    Posts:
    4
    Still croaks every VS save when running. No preference settings fix this. Collaborate not installed. Oculus integration is tho, so that is likely the culprit.
     
  10. AVX010

    AVX010

    Joined:
    Sep 5, 2018
    Posts:
    1
    Changing the 'Script Changes While Playing' setting to 'Recompile After Finished Playing' in Preferences - General fixed this issue for me.

    Thanks Brathnann !