Eclipse, C#, and Unity

So, I’ve been trying to start using Eclipse (with the Emonic C# plugin) with Unity, mainly for ease of debugging, unit testing, and integration with code repositories. I’m still stumped on how I get Eclipse to use the UnityEngine namespace, or, more accurately, how to actually get the UnityEngine namespace.

Any help?

Cool, I had not heard about the Emonic plugin. Im going to try it!

Have you tried to right-click the project and add a reference to UnityEngine.dll Thats how I do it in Visual Studio. Then, of course, put “using UnityEngine;” at the beginning of every .cs file.

You can debug with Visual Studio? You mean with Parallels?
Could debugging work with Xcode? Or at least the editor with code-completion?

Very interesting thread!!
I’m also interested in knowing more about VS, big fan.

I’m trying eclipse with emonic (thanks for the tip, if it saves me installing Parallels, Windows and VS, it could be worth the switch!), but I get errors whenever I try to open a script, I get an error (Reason: , check the details => ERROR… :lol:).

Do I have to install Mono, or will Unity’s version do?

Yes, you can debug c# code in VS with Parallels, but calls to Unity dll won’t work, you need to keep graphic code separed from logic code (with functions or conditional compilation).

Something like this:

    internal static bool IsWin
    {
        get
        {
#if WINDEBUG
            return true;
#else
            return Application.platform.Equals(UnityEngine.RuntimePlatform.WindowsWebPlayer);
#endif
        }
    }

With Unity2 you need VS2005

Eeeew… that’s ugly!
You mean you can’t reference the UnityEngine.dll in VS? or just that you can’t compile and run the whole thing?

Debugging aside, just using VS to do all the code completion (crawling my files and knowing the Unity API) would be a huge plus.

Of course debugging would be an even huger plus but… well… good ol’ trial and error is what gamers do anyway 8)

I’m only 2 hours into eclipse and already I hate the code completion, it’s so clumsy compared to VS.

Forget what I said, I just tried a java project: eclipse’s completion engine is really not that bad!
It’s emonic who’s… well, not there yet.

I still have hope in Xcode. There is a Mono C# plugin for Xcode. Did nobody tried this?

:smile:
Not that ugly!
If you need only code completion you can reference the Unityengine.dll and code without #if.

I utilize it to compile and run the application in Windows.

Sorry for XCode, I dont’like it and I never tried it with Unity

Very good news! Isn’t it too bad to use VS with a mac keyboard?

Now to get a copy of Parallels or VMware… any idea if VS2005 will run under CrossOver? Somehow I doubt it, but that would even save the Windows license.

Wow… that’s impressive!
But how do you run it if you can’t use graphics? Do you just run, attach a debugger, and see what happens without having anything render on screen?

Actually I use VMWare Fusion to run Visual Studio. I have a shared folder setup in vmware to directly access the code files (assets) in my Unity project. Works great! I would prefer to use a native OS X ide as opposed to using a windows program. But so far I haven’t found any IDE that can compete with Visual Studio… the code completion (intellisense) is priceless.

NOTE: I only use Visual Studio to EDIT the source code. I never use it to compile or debug the code. I have found this isn’t a big deal, because Unity compiles the code as soon as I save it in visual studio. I use unity’s Print commands for debugging.

It’s like in Windows, I’ve only remapped the F9 and the F10 key in Osx.

I’ve never attached the debugger to the exe generated by Unity and I don’t know if it works. I’ve all cs files in a solution and a form with some buttons to debug specific parts of code, so I can debug it with breakpoints in VS.
Graphics parts are debugged in Unity with Debug.Log calls.

Very clever indeed!

So I installed VMware, Vista, and VS 2008, bam, what the hell, might as well use all the latest versions!

I works like a charm! My precious autocomplete is back and kicking ass!
Also, I don’t know if you guys know about this addin that allows you to link to a whole directory (it creates the directory structure for you and references all files as links). This way the integration with Unity is perfect.
It’s a 2005 addin but all you have to do is put it into the Addins folder in My documents\VS 2008, edit the .AddIn file and set to 9.0 instead of 8.0.
Heck, I’ll just zip the thing and post it here, I don’t even think you need to download and install the MSI installer.

BTW, WMware is just awesome, with the Unity feature (hey, the stole the name ;)), it’s just seamless. You have to see the Windows windows (…) squeeze back in the dock to believe it.
Vista is neat, I never had time to make the switch from XP on my PC but it’s cool to see it on my Mac!
And VS 2008 looks even cooler than ever, yay! Apparently they’re making a VS shell to concurrence Eclipse… definitely, with this + Unity 2, 2008 is gonna be an awesome year!

50025–1833–$add_directory_content_121.zip (14.8 KB)

Cool! You just made my day… In finally got into Unity and after one day of “playing around” I must say - it’s really soooooo cooooool! Only thing that got at me was the missing Intellisense support… reminded me of those bad JavaScript and ActionScript days where I spent more time trying to figure out the spelling and what was available where, and then debugging ugly errors than actually implementing functionality.

But with this wonderful thread, it seems I can use my VMWare Fusion WinXP + Visual Studio .NET 2005 installation just smooooothly.

Guess I’m gonna get Pro today… 08/12 sounds like a cool date for that :wink: … let’s UNIFY the world :slight_smile:

Joyful regards,
Jashan (who just got up at noon after being up until 3am last night, hehe)

The Add Directory Content addin is awesome! It’s totally made my day.
Thanks Ben, if you ever come to South Korea, I’ll buy u a beer, or a brewery! :smile:

Glad you liked, but the real credit goes to the guy who created it.
I actually don’t use the addin anymore, I just put the project file directly in the root of Unity project (besides the Assets and Library folders).
Either way, you need to manually update stuff in VS when you move files around anyway… still not perfect.

South Korea isn’t in my plans for now, but I guess I’ll just have to change them… I just can’t refuse a free beer :wink: !

I was using that method before - but I never got code completion to work for classes I wrote - It was fine for Refs that I added but not for anything with .cs files.
I was using a Web Project though. Couldn’t get things running as a normal VS project.

I tried this with Parallels, Vista, and VS2008 and it works well for auto-completion, which is a nice time saver for me.

Does anyone know how to set up VS in Parallels as the default script editor for Unity? The Unity Preferences panel seems to require a Mac OS application to be selected in a file browser as the default editor. The Parallels smart-select feature (opening certain files in windows apps based on file extension) seems to be overridden by the Unity preferences.

Thanks,
Ricko

Wow, didn’t know about that, any idea if this exists with VMware? I constantly double-click the debug console and of course Unitron shows up… very frustrating!

Have you tried directly setting Parallels as the external script editor? Maybe then it’d redirect it to VS?
I’d say it’s either that or wait for UT to implement a “just let OS X open the file” option… or maybe even write a quick OSX app that would accept the script as parameter and then feed it to Parallels, or even OSX directly, kinda like .NET’s System.Diagnostics.Process.Start… I suppose there’s an equivalent in OSX.