VisualStudio 2010 intellisense doesn't recognize UnityEngine

I’ve recently decided that I’d like to develop on a larger monitor, so I’ve moved from my laptop and installed Unity on my desktop. Problem is, Unity doesn’t seem to understand that I want to use VisualStudio instead of uck MonoDevelop.

When double-clicking a .cs file in the Project window, it brings up the “Opening Visual Studio” window, and then opens MonoDevelop. I tried packing the MonoDevelop /bin/ folder into a .rar to hide it, which gets VisualStudio to actually open. Problem is, it doesn’t generate a solution and the intellisense doesn’t work. It doesn’t throw any errors, but it doesn’t actually do any of the highlighting or autocomplete (MonoBehavior shows up in black instead of class blue). It also doesn’t care if I write this:

        if (Input.GetKey(KeyCode.W))
            Debug.Log("Something");

so it’s recognizing the library.

Anyone have a similar problem or a solution? I’ve got my preferences set to use VS as the default, and I’ve restarted Unity and my computer to no avail. Using VS 2010: Ultimate. That and Unity are both installed in their default directories. I had an older version of Unity before installing VS and updating Unity to the current, if that helps.

Edit: Please help. Caps Lock makes MonoDevelop think that Shift is being pressed. I don’t even what.

Hi Jeff,
This happens when Visual Studio reports that there was an error opening the solution. If you have any dialogs popping up (Resharper license dialog, etc.) when VS starts, this can trigger the same behavior.

Things to try:

  • Ensure that your default script editor is set to VS2010 in the Unity preferences
  • Ensure that VS starts cleanly without any problems, popups, etc.
  • Ensure that you are able to manually open Assets/YourProject-csharp.sln using VS
  • Remove all .sln and .csproj from your project’s Assets folder and resynchronize your solution using Assets->Sync MonoDevelop Project within Unity

Sorry for the delay, caught a stomach virus and have been out of commission for a while.

I switched the preference from Mono to VS and back a few times, which didn’t help. VS starts cleanly, and I can manually open the .sln file. I’ll try resynchronizing and get back to you.

Edit: Yep, I’ve got VS working with Unity correctly, though Unity still opens Mono when going through the Project window.