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
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
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 . 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.
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
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:
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.
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.
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.