I can now finally jump into the Unity train from my windows PC and it’s indeed a great pleasure to discover such a lovely application. Gotta love C# support too
I am trying to get a nice workflow going with visual studio express and I can only find posts relating to the MAC/Parallels setup so please forgive me if I’m asking dumb questions.
So I’m on windows…
Question 1 - My scripts open in VS express but they keep spawning new instances of the IDE. I noticed that someone wrote a wrapper to prevent this from happening. Is it currently the main way of dealing with this issue? Isn’t there a simpler way to prevent this from happening?
Question 2 - To get intellisense to work, I currently need to create a solution and add UnityEngine.dll as a reference. But if my solution folder sits outside of the Assets folder then each script gets doubled (one copy in Assets and one in the solution folder). Now if I put my solution folder in Assets, then the auto-refresh in unity sometimes complains about temporary files from VS. What is the correct approach? Even if I use symlinks, I keep getting doubled files.
Any advice or pointer would be much appreciated.
Lots of love.
Check your Add button (in the file open dialog that pops up when you wanna add a script in VS). The button should have little down arrow in it, click on that part and select to add the file as link. This way you can place your solution where ever you want and the scripts will stay put in your Unity path structure
Another thing I do is to create the solution/project in VS as class library. This way I can hit F6 now and then to quickly checks for some parse errors before testing in Unity (works if you got unity DLLs references).
The only way I know of to force VS to open a file using an existing instance is to pass the /Edit option to the IDE application (devenv). This does require a wrapper, of course, but a simple batch file can do the job nicely. Just paste the following line of text into a batch file:
@"C:\Utils\Microsoft Visual Studio 9.0\Common7\IDE\devenv" /Edit %1
Replace the devenv path with whatever works on your machine, tell Unity to open scripts via the batch file (Edit → Preferences → External Script Editor), and enjoy!
I just tried this with Visual Studio C# Express and it doesn’t have the /Edit command. Do you know what has to change to get it to open in an existing window?
@"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCSExpress" "C:\Users\[user name]\Documents\myProj\myProj.csproj" %1
I just posted a program in another thread that uses a different method of launching Visual Studio, and it even allows it to jump to the specified line number after loading the source file. I don’t know if it will work with Visual Studio Express, although you could give it a shot. [link]
Two questions:
How do I open one instance of VS from double clicking in Unity on a mac (virtual machine)?
Is there a way to open the script from unity at the right line ?
Thanks
I don’t believe there is any way to do that, although if someone knows differently, please post a “how to”.
I’m currently working with Unity iPhone on OS X, and using Parallels to run VS2008 under WinXP. Originally I was simply mapped the OS X drive under WinXP, and worked directly with the Unity project files, although for various reasons, I have switched to working with a stand-alone VS project, and a pretty handy SourceForge app that keeps everything in sync. If you want more details, I’ll send them.
For a while, I was editing Unity C# scripts with TextMate, but after switching to VS2008, I don’t know how I every got anything accomplished. VS2008 is the way to go if you’re doing any serious C# programming.