Awesome!! Today, Microsoft released a “code optimized” version of Visual Studio called Visual Studio Code that will run on Mac and Linux (and of course Windows). And it is BEAUTIFUL! I’ve been looking for an alternative to MonoDevelop with Unity 3D for some time, and VS Code feels like it might be the real deal.
- Visual Studio 2019 Unity Tools
- Microsoft Visual Studio Mac Unity
- Unity Mac Visual Studio
- Mac Unity Vscode
Some early commenters on the Unity 3D forum were peeved that it’s not a full-blown IDE, or “it’ll only be good for Javascript and web dev”. Do not listen to the naysayers! Granted, it is a “Preview” version product, but so far, it is working with Unity 5 like a charm.
Setting up VSCode for Unity is Simple, but Read This!
It is simple to get it working, but you need to do a couple of things. Some people on the Unity forums tried to simply download Code and open their c# files and the intellisense didn’t work, and they assumed that VS Code was a bust. I admit, that’s exactly what I did, but I didn’t give up. Here are the simple steps:
- Download and install Visual Studio Code from Microsoft
- It’s simple on the Mac…just drag the .app to Applications folder once you open the downloaded package
- Open your Unity project
- Go to Assets > Sync MonoDevelop Project (this will make sure your .sln file is all set)
- Open VS Code
- Do File > Open in VSCode and open your Unity project folder (top level of your project)
- Important – at the bottom of the VS Code window, there is a blue status bar. You should see a little fire icon. It may be followed by # projects. Click that icon and select your project’s csharp.sln file. When you click the icon, it will pop up a box at the top that lists the available solution files. You want the one that is named “<your project name>-csharp.sln”.
- If the box at the top of the screen has an option that says “Change projects”, that means you’re already working in a project. In this case, you can:
- Click “Change projects”
- Then select your project’s csharp.sln file as above
- If the box at the top of the screen has an option that says “Change projects”, that means you’re already working in a project. In this case, you can:
Visual Studio Code on a 2013 MacBook Pro- 1st Day Impressions
- Intellisense is working beautifully with my project’s code
- You can even leave a word half finished go away with the cursor and come back and Intellisense will pick it up and start working where you left off. I’ve been using VS 2010 at work lately and it doesn’t do that…very annoying
- VSCode is fast and responsive
- It looks great!
- Haven’t tried the Git and probably won’t. I’m using SourceTree for BitBucket with Unity and the integrated client in Xcode for normal dev
- It feels like a native Mac app, but some of the Keyboard shortcuts aren’t Mac…maybe there’s a way to fix that
- For instance, Cmd-Delete is supposed to delete everything to the left of the cursor back to beginning of the line of text you’re on, but it doesn’t appear to be doing anything
- Shift+Cmd+k deletes the whole line
- Control-Delete, weirdly, duplicates the text on the line…huh.
- Control-Clicking on a file in the file tree opens the code in side-by-side view with the existing file in the editor…neat
- I tried editing the Keyboard shortcuts, but adding my edits to the override file didn’t work, even after restarting the app. You can tell it’s early days since that process is you editing a json file.
All-in-all, I’m very happy to have Microsoft supporting Mac with this. They also announced a code transformer that will let you take your iOS objective-c code and port it to Windows phone with minimal tweaks. That’s going to be interesting too. Microsoft is really doing some very interesting things. Good on ya!
Old Instructions / Mac Instructions. Unity can now easily create a Visual Studio project for you. This is all you need if you're using Windows for development - if, however, you like to develop on the Mac and still use Visual Studio (because it's the best IDE), also have a look at the old instructions.
Cheers,
- Note: After Unity 2.6 and the built-in Visual Studio integration, you'll want to drop the files in your 'Unity Editor Data lib' folder. If you had an existing Visual Studio project, you will need to drop and re-add the UnityEditor.dll and UnityEngine.dll references (from the lib folder just listed) before the documentation will show up.
- A powerful feature of Tools for Unity in Visual Studio for Mac is the ability to set breakpoints and debug C#. If you’re familiar with debugging in any other.NET project, you’ll know what to expect. Set your breakpoints and press the Play button in Visual Studio for Mac to attach the debugger to Unity.
- To activate a Unity Personal licence, select the Unity Personal option and select either of the options which best describes your current situation and click Done. STEP 5 - RUNNING UNITY AND FINAL CHECKS. To test Unity is installed correctly and ensure Visual Studio is working, we will make a test project.
- Visual Studio for Mac Tools for Unity.; 2 minutes to read +3; In this article. Visual Studio for Mac Tools for Unity is a free Visual Studio extension that turns Visual Studio for Mac into a powerful tool for developing cross-platform games and apps with the Unity platform.
Byron
Author(s):
Jashan Chittesh
This includes contributions from the Unity forums by benblo and Lka(collected from various threads in the Unity forums)
Jashan Chittesh
This includes contributions from the Unity forums by benblo and Lka(collected from various threads in the Unity forums)
|
Old Instructions / Mac Instructions
Unity can now easily create a Visual Studio project for you. This is all you need if you're using Windows for development - if, however, you like to develop on the Mac and still use Visual Studio (because it's the best IDE), also have a look at the old instructions. This also has information on how to get Intellisense documentation:
- Setting up Visual Studio for Unity on Mac / instructions for using Visual Studio on the Mac
Creating a Visual Studio Solution
To create a Visual Studio Solution:
- Click Assets->'Sync VisualStudio Project'
- Open Visual Studio
- Click File->Open->'Project/Solution..'
- Locate the .sln which is likely at the root of your project.
Important note about file renaming
If you need to rename a behaviour (non-behaviour scripts don't matter), make sure to do it in Unity! If you rename it in VS, Unity will consider it a new file, and all references to it (components) will be lost.
Then in VS, exclude the script, display all files in the solution explorer, include the new renamed script, and finally rename the class in the editor (and enjoy some sweet refactoring :). It's a tad tedious, but once you get the habit it's not that bad.
Note that if you forget and rename in VS, all is not lost. Just find the components in Unity, you'll see all their properties are still there but the script reference (it will say 'Missing Mono Behaviour'). Just drop the renamed script in the script box, and yay, you didn't lose any property!
Version Control
UT's Asset Server
The best solution to version control for Unity is probably UT's Asset Server. I'm using this now and thus I have dropped Subversion, but for reference for people who would prefer to use Subversion:
Subversion
If you want version control, you may want to try Subversion:http://subversion.tigris.org/
It’s very convenient to use on Windows with TortoiseSVN:http://tortoisesvn.tigris.org/
One important note: In the setup I’m using, I don’t version control the actual VS.NET project. There’s not really much worthwhile version controlling in there, anyways. Instead, I directly put the script files from my assets folder under version control. I have those on a share mapped to a drive. Don’t get confused when TortoiseSVN doesn’t automatically, create the relevant icon overlays, you need to change the settings for that to work correctly: Right click on some item in the explorer to get the context menu, go to TortoiseSVN/Settings. In there, under Look and Feel, you find Icon Overlays, and there, under Drive Types, you’ll find Network Drives is not checked. Mac yosemite installer download. Check it, and the world is wonderful again ;-)
There is also a Subversion-plugin for Visual Studio.NET 2005, but personally, I didn’t really like it. If you still want to give it a try: http://ankhsvn.tigris.org/.
If you want a great SVN plugin for VS.NET you should use VisualSVN[1]. It is not free, but pretty cheap and it works like a charm.
I would not recommend using Subversion for version controlling the binary assets - I'd only use it for scripts and textfiles. Some people (see this posting for an example) have reported trouble someone along the way when version controlling Unity projects (including the binary assets) with Subversion, so you have been warned ;-)
Subversion, another take
This is drawn mostly from experiences with using Unity and SVN at the Global Game Jam 2009.
As said above, scripts textfiles and also assetfiles work well with Unity. You can also version scenes and prefabs, but since they are binary and cannot be merged - you will have to take care when a conflict arises. Typically this will mean that you have to update, make the changes you want again and then commit. Makes a good case for commiting often!
The worst part to use SVN for is the Library folder. The cache should definately be ignored, and most of the other stuff - including metadata - changes so often that you always get conflicts. What we did was to ignore the library folder completely. This has the unfortunate effect that references to scrips/prefabs/assets for things in the scenes and prefabs does not get saved. Simple properties do - just not references. This lead to tedious work of recreating what others have set up in your local copy. We remedied that by having one machine that was the master machine. On that machine we integrated everything, build the game and made sure it ran. When this was over we shut down Unity. Zipped the library folder and put that in SVN. Others could then update to get the zip and all changes, shut down Unity, remove the library folder and unpack the new one. Then they would be up and running. Somewhat tedious, but it worked for us.
Some nice Add-Ons to Consider
OBSOLETE: One click Unity & Visual Studio integration (Mac)
Note: This is obsolete since Unity has integrated creating visual studio solutions. For issues specific to Mac when using Visual Studio (in a virtual machine environment), see:
- Setting up Visual Studio for Unity on Mac - Instructions for using Visual Studio on the Mac
Check out Lucas Meijer's blog post which also has a very nice Unity package which makes integrating Unity with Visual Studio even easier:http://lucasmeijer.com/posts/one-click-unity-visual-studio-integration/
OBSOLETE: One click Unity & Visual Studio integration (Windows)
NOTE: This is obsolete now that Unity has full Visual Studio solution support integrated (in particular, no reason to worry about symbolic links anymore as Unity does it all right for you).
Go to Lucas Meijer's blog post and download his Unity package: http://lucasmeijer.com/posts/one-click-unity-visual-studio-integration/
Videolan mac download. Windows is not able to create symbolic links in the same way as OSX so Meijer's script needs to be modified a little:
- Download Junction from http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
- Extract junction.exe from the zip archive and move it to your Windows installation folder, normally C:Windows.
- Import the package and change line 17 in CreateVisualStudioSolution.cs to
Now you can re-export the package for future use in other Unity projects.(Verified on Vista, should work the same for Windows XP)
Visual Studio 2019 Unity Tools
Consolas Fontpack
Consider getting the Consolas Fontpack which looks much better than Courier.
Don’t forget to switch on ClearType – it’s not on by default. See instructions here: EnglishGerman
Microsoft Visual Studio 2005 IDE Enhancements
You might also want to install: Programs like gimp for mac.
InternetExplorer Developer Toolbar
If you’re also developing ASP.NET content, you may consider downloading and installing:
UML Modelling with UModel
If you’re developing complex applications, you may consider using UML to not model the various levels of the application in a more abstract manner than just code. I found Altova Umodel a very nice tool because it supports round-trip engineering and can be smoothly integrated into Visual Studio .NET 2005 and 2008.
VERY IMPORTANT: Use UModel only with version control (or make frequent backup copies of the relevant UModel project files). I almost lost a few hours of work because I rearranged the folder structure inside of Unity on time, and another time because somehow I opened VS.NET 2008 while my network connection from the VMWare to my Mac somehow was broken. The result was that UModel did not find any classes anymore and automatically removed all the classes from all the diagrams. Fortunately, I made a copy of the UModel project file before saving this disaster. So make sure you check in the UModel project file after you’ve worked on it, so when UModel does weird things, you don’t lose your precious time..
Note: This never happened to me again, so I'm not saying UModel is buggy or something, but it's just wise to be a bit cautious with software ;-)
Microsoft Visual Studio Mac Unity
Using Visual C# Express As the code editor
If you are using Windows and are editing C# scripts in Visual Studio or C# Express, the new 'Assets->Sync VisualStudio Project' option is nice. However, using Visual C# Express edition, you are limited in that you cannot double-click on a script or warning/error in Unity and have it open in Visual C# Express. Here is a workaround for that limitation:
1) Download ClassExec and extract to a folder of your choosing.
2) Create a batch file and put the following line :
1) Download ClassExec and extract to a folder of your choosing.
2) Create a batch file and put the following line :
3) In Unity, under Edit->Preferences->External Script Editor, select the batch file you created above.
4) In Unity, after using 'Assets->Sync VisualStudio Project' and opening the solution in Visual C# Express, double clicking a script or a warning/error in the console will cause it to open in the same instance of Visual C# Express, allowing you to enjoy easy integration between the two IDEs.
4) In Unity, after using 'Assets->Sync VisualStudio Project' and opening the solution in Visual C# Express, double clicking a script or a warning/error in the console will cause it to open in the same instance of Visual C# Express, allowing you to enjoy easy integration between the two IDEs.
As an alternative, instead of downloading the ClassExec program you can:
Unity Mac Visual Studio
1. Skip downloading ClassExec
2. Create the batch file, as above, but with the following line :
2. Create the batch file, as above, but with the following line :
3-4. Same as Steps 3-4 in the instructions using the ClassExec
This method works for both Windows 7 and Vista. Haven't tested other systems.
Mac Unity Vscode
Retrieved from 'http://wiki.unity3d.com/index.php?title=Setting_up_Visual_Studio_for_Unity&oldid=13095'