Search Unity

Question Automatically save scripts when returning to Unity from Visual Studio

Discussion in 'Code Editors & IDEs' started by BPPX, Sep 23, 2023.

  1. BPPX

    BPPX

    Joined:
    Apr 16, 2017
    Posts:
    9
    I'd like to know how to get Unity to recompile scripts automatically (when editing is done from Visual Studio or other editors and switching back to Unity). I always forget to save the script and the play button in unity doesn't save the script for me.

    I know VS has an autosave feature:

    However, I only want the script to be saved and recompiled when unity gets focus (the front active window).
     
    Last edited: Sep 23, 2023
  2. Deleted User

    Deleted User

    Guest

    Ctrl+s, you can't expect anything to do your job for you. :)
     
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,817
    What's the issue with the script being saved when you bring any other app but Unity to the foreground?
     
  4. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
    We have once solved that problem (or at least a problem like that) in Rider.
    If saving is delayed a bit, Unity would not detect the changes. Try to move focus there and back couple of times and see, if it helps Unity to detect the changes.
     
  5. BPPX

    BPPX

    Joined:
    Apr 16, 2017
    Posts:
    9
    There's nothing issue with it. It's just that I think this solution should be done by Unity or VS Unity Tool.
     
  6. Deleted User

    Deleted User

    Guest

    What's wrong with saving your work before going back to Unity? :D