At the moment, the developer from VS Tools for Unity admitted that this is the most requested request from developers. But it turned out to be surprisingly not trivial for them and they are working on it.
However, at the moment, there is a script that you can use. It was taken from here and from the Russian community thanks to the user DbIMok
FileModDialogCloser.cs should be created in the Editor folder and the code below should be FileModDialogCloser.cs into it.
using System; using System.Runtime.InteropServices; using UnityEditor; [InitializeOnLoad] public class FileModDialogCloser { [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo); const string search = "File Modification Detected"; static IntPtr hwnd; static void Check() { hwnd = FindWindowByCaption(IntPtr.Zero, search); if ((int)hwnd != 0) { ShowWindow(hwnd, 5); keybd_event(0x0D, 0, 0, 0); } } static FileModDialogCloser() { EditorApplication.update += Check; } }
We are surprised! It works both when creating a C # script and when deleting it.
As you can see, the code has the string keybd_event(0x0D, 0, 0, 0); . This is an imitation of pressing the Enter key, which means at the moment it is a Reload implementation. For ReloadAll you need to do this:
keybd_event(0x09, 0, 0, 0); keybd_event(0x0D, 0, 0, 0);
This is pressing Tab and then Enter.
A small drawback: The window appears and fulfills the event. The window is hiding. It all the same happens quickly and you don’t need to press anything yourself. But in another way, this problem cannot be solved yet.
ADDITIONALLY:
You can create files for a Unity project directly from Visual Studio . Unity will automatically pick them up and no windows will appear.
1 way (simple) :
When using Visual Studio Tools for Unity , this tool (as I understand it) already integrates two templates into the studio for creating a C # script. Therefore, by clicking on Solution PKM and selecting Add -> NewItem , then you can already see two ready-made templates:


However, the template may contain unnecessary information for you, for example, comments // Use this for initialization , // Update is called once per frame , etc., so you can create any template for yourself:
2 way :
- Create a file from anywhere.

- Add what you want and delete the excess, like this:


- In the list we mark our template.

- Click
Next again - Choose a name for the Template and its description and click
Finish

- The template will appear in the
c:\Users\YOUR_PROFILE\Documents\Visual Studio 2015\My Exported Templates\ folder, as well as in c:\Users\YOUR_PROFILE\Documents\Visual Studio 2015\Templates\ItemTemplates\ . After rebooting the studio, you will see this template in the list as well as templates from VS Tools for Unity :

Here is a link to the video for more understanding.
Happy End!