Visual Studio and Unity iPhone

I just had a look at Lucas Meijer’s exellent package for creating a Visual Studio project inside Unity (from here) and found to my dismay that it doesn’t work in Unity iPhone, mostly due to an overload of DirectoryInfo.GetFile() that isn’t available in the version of Mono/.NET that Unity iPhone uses.

It was a simple fix though, and it’s all working brilliantly now so I’m attaching it here for all you iPhone devs that are C# inclined.

As an added bonus I put the Unity iPhone classes into the package’s UnityEngine.xml file, so they should show up with a proper description in VS.

Enjoy!

Edit: Updated to support proper recursion through all subdirectories

180791–6436–$createvisualstudiosolutioniphone_171.unitypackage (125 KB)

Thank you pal… I was so lazy to port it :wink:

I’ll try it definitely in my next project…

Sanjuro

many thanks indeed!

Something that I also needed to do was to put the unity dlls from the iphone version (open up the .app package on the mac) then I copied them over to the unity version I have on my VM ware fusion install.

It means the the unity version on the Windows emulator wont work anymore, but that Visual Studio will happily pick up iphone related functions :smile:

The script in the above package should automatically add a copy of the Unity iPhone dlls to the VS project folder it creates, so VS should pick them up without having to copy them or add them to the VS project manually. No need to bork your Windows Unity install, either!

Thanks for this great peace of code :smile:. I was already bugging for a few hours with the Unity 2.1 source from Lucas Meijer.

I still have another Question about the xml help files. How are they created or extended. I mean is there some way to build it dynamically from scratch if the Unity iphone Dll’s get extended with a newer release.

Peter.

I have been using VS for iPhone dev for months now. It’s so great!

Has anyone been able to make new DLLs for Unity iPhone 1.5 yet? Or can point me to how to do it myself?

The above script grabs the .dll files directly from the Editor itself, so if you run the script using 1.5 it will get the 1.5 .dlls automatically. The xml docs won’t reflect this, though, as they’re included in the asset bundle itself.

I’ll have to update the .xml docs at some point and post a new version, but other than that it should work in 1.5.

Edit: Just tested it myself and recreating the project from the script pulls in the new .dlls, so all the new stuff shows up in Visual Studio (just without descriptions).

I manually setup my VS environment and I am afraid if I use your package it may change/break things that are working the way I want. Is there a way to get these DLLs myself manually somehow? Am I overcomplicating this? hehe, Are they just files I need to copy from somehwere? I thought they were generated using some kind of tool.

Usually benblo (he’s also on the forums) has created those. I guess he has written some sort of script to create them from the HTML Unity API documentation - very much appreciated :wink:

I’ve just checked the links from the article in the Unifycommunity Wiki and those currently seem to not really work, so it might be best to ask him directly.

The DLL-locations on the Mac are also mentioned on the Wiki article I previously posted. Maybe someone would be so kind to extend this with the location of the same DLLs on a Windows Unity install:

Setting up Visual Studio for Unity - The Reference to UnityEngine.dll and UnityEditor.dll

maybe I’m doing it wrong, but if you use nested folders, it doesn’t find the .cs files.

sorry for my ignorance, but how do you setup your work flow with iPhone and VS?

Maybe I’m mistaken, but you can only develop for iPhone in Mac OS X and VS is MS Windows only.

Please share the wisdom, would love to use VS as well as I have VS2008 Pro on my laptop.

The way I have done it that works quite well is dual monitor on a Mac Mini (4GB/SSD) where I am running VMWare with WindowsXP/VS2008 on my right monitor and Unity on my left. You could also network two different machines like your laptop and a mac. Using the plugin for VS mentioned in the wiki, it will add references to the shared CS files over a network share.

DOH! I feel pretty stupid as I have had to do this before when I first set it up. Thanks :slight_smile:

See the link above to the Unifycommunity Wiki (or below at the end of this posting). The way to do this is having Windows run in a virtual machine (VMWare Fusion or Parallels Desktop). That way, you can have both Unity iPhone (on the Mac) and Visual Studio (running on Windows inside the virtual machine). Works pretty much seamlessly - only thing I can’t get to work is directly jumping to the line numbers in the files.

So, here’s the link again (for your convenience): Setting up Visual Studio for Unity - Basic VMWare (or Parallels) and Visual Studio installation

If anyone ever gets that working, this will be perfect!

thanks a lot mate! Looks very good, had Parallels installed already, now following your link to install the rest!

What a day, installed Unity 1.5 and if I make it work under Visual Studio its like Christmas came early for me :smile:

Thanks for the work getting this stuff working in VS!
I’m posting just so if someone posts in here about updated 1.5 xml files I’ll know about it :slight_smile:

Doh, sorry about that. I haven’t actually done much work in Unity lately so I hadn’t tested it very thoroughly - it actually only traversed the assets folder one level deep, which doesn’t work so well if you organise your scripts into folders better than I obviously do. :lol:

I’ve updated the package in the first post, so it should recursively grab files from ALL the subdirectories now.

Hi,

I have installed Parallels with Windows XP and C# Express.

I’ve also created a new iPhone project with your package, but completely stuck of what I need to do next?

On link you’ve provided Lucas talks about creating VS project from Custom Tools menu, but I can’t find such thing in my Unity iPhone?

Please help, really want to set this thing up!! :slight_smile: