Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

How to Disable Visual Studio Dialog : "File Modification Detected"

Discussion in 'External Tools' started by elliv, Oct 30, 2015.

  1. elliv

    elliv

    Joined:
    Oct 29, 2015
    Posts:
    2
    Everytime I opened a .cs file inside unity editor, my visual studio always showing this dialogue


    I already have "Detect when file is changed outside the environment" disabled, but doesn't seem to solve the issue

    At first it wasn't such issue but now it's getting annoying :(
    anyone know how to fix it
     
  2. ABerlemont

    ABerlemont

    Joined:
    Sep 27, 2012
    Posts:
    23
    Same here ! Can't figure it out :(
     
  3. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    771
    Ya I would LOVE to get rid of these. I get this popup window any time I change anything in the Unity editor and tab back into VS 2015. Grrrrr.
     
  4. coman_games

    coman_games

    Joined:
    Dec 12, 2015
    Posts:
    7
    Just go in Visual studio to
    • Tools -> Options->Environment -> Documents
    And uncheck "Detect when files changed outside the environment". And you are done!
     
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,310
    Yeah, but then the changes made outside will not reload! You'll be working with old files and if you change anything and save you'll overwrite the external changes. ;)
     
  6. coman_games

    coman_games

    Joined:
    Dec 12, 2015
    Posts:
    7
    Yes! but I never made changes to the code outside the Visual Studio. And this is only for a code. So if I will add some file picture for example or texture no problems.If I will import .cs files I will just restart VS to load the latest version of file. So it is perfect for me while I am working in Unity with VS. Nothing happened after I started work like that. And this message not annoying me any more.
     
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,310
    Okay, I see... But still it should be clearly stated that it works only in your specific situation and it's a dangerous configuration for others, as most people would have a version control system through which changes may easily happen outside of VS. Right?
     
  8. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    136
    Hi folks,

    Jb from the VS Tools for Unity team here.

    We're very much aware of this issue, it's one of our most voted feature request. It's surprisingly not trivial to fix, but we're on it.
     
    sarahnorthway and Flipbookee like this.
  9. iprogrammer

    iprogrammer

    Joined:
    Jan 4, 2015
    Posts:
    13
    Hi!
    Any success?))
     
  10. DbIMok

    DbIMok

    Joined:
    Sep 19, 2011
    Posts:
    23
    Code (CSharp):
    1. using System;
    2. using System.Runtime.InteropServices;
    3. using UnityEditor;
    4.  
    5. [InitializeOnLoad]
    6. public class FileModDialogCloser {
    7.  
    8.     [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
    9.     static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
    10.  
    11.     [DllImport("user32.dll")]
    12.     static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    13.  
    14.     [DllImport("user32.dll")]
    15.     static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
    16.  
    17.     const string search = "File Modification Detected";
    18.     static IntPtr hwnd;
    19.  
    20.     static void Check() {
    21.         hwnd = FindWindowByCaption(IntPtr.Zero, search);
    22.         if ((int)hwnd != 0) {
    23.             ShowWindow(hwnd, 5);
    24.             keybd_event(0x09, 0, 0, 0);
    25.             keybd_event(0x0D, 0, 0, 0);
    26.         }
    27.     }
    28.  
    29.     static FileModDialogCloser() {
    30.         EditorApplication.update += Check;
    31.     }
    32. }
     
    Last edited: Feb 14, 2017
  11. equal

    equal

    Joined:
    Dec 14, 2012
    Posts:
    28
    May the Gods bless your soul
     
  12. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    159
    TRULY may the gods bless your soul

    I am still having this issue in Visual Studio 2017 with Unity 5.6
     
  13. DbIMok

    DbIMok

    Joined:
    Sep 19, 2011
    Posts:
    23
    For many reasons this is not a good solution. So I coded the extension for VS 2017 FMDKiller.vsix For previous Visual Studio versions, just paste the code into the standard extension template (think you need to change only PackageGuidString) and build.
     

    Attached Files:

    Last edited: May 12, 2017
    wmadwand and Kroc_ like this.
  14. Kroc_

    Kroc_

    Joined:
    Jul 23, 2014
    Posts:
    24
    Can confirm the extension works perfectly with VS 2017.. let me hug you
     
  15. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    159
    the extension works, thank you DblMok
     
  16. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    159
    Hey DblMok, the FMDKiller extension broke with the latest update of Visual Studio 2017 Community

    please help!

    Also, an option for it to automatically "ignore" instead of "reload" everytime would be great
     
  17. DbIMok

    DbIMok

    Joined:
    Sep 19, 2011
    Posts:
    23
    Here is the link to the full extension solution https://github.com/dmbond/FMDKiller/ You can debug or change the behavior to "ignore" (but I do not think this is a good choice).
     
    Last edited: Jun 8, 2017
  18. wmadwand

    wmadwand

    Joined:
    Jul 19, 2014
    Posts:
    13
    DbIMok likes this.
  19. DbIMok

    DbIMok

    Joined:
    Sep 19, 2011
    Posts:
    23
    from 3.5.0.2 (04.12.2017) UnityVS auto sync projects