11.25
Unity iPhone will only run on OS X. Visual Studio 2008 will only run on Windows. With the use of virtualization software, such as Parallels and VMWare Fusion, you can easily run Windows software alongside OS X apps. Configuring Unity and VS2008 so that they work well together is not difficult at all, as the following procedure demonstrates.
Please leave a comment if you have any questions regarding the steps or suggestions on how to improve the process, security, or any other related issue.
Prepare Unity iPhone

Unity iPhone Project Wizard

Create the VS2008 Solution

Visual Studio Project Folder
- Download the iPhone-compatible version of Lucas Meijer’s Visual Studio integration package from the Unity forum thread “Visual Studio and Unity iPhone“. The file is called ‘CreateVisualStudioSolutioniPhone.unityPackage’, and is attached to the bottom of the first post. If you don’t see the download link, log in to the forum first.
- Copy the package to the “/Applications/Unity iPhone/Standard Packages” folder. While you can just import this package into an existing project, placing it in the Standard Packages folder will add it as an option when creating all new Unity iPhone projects.
- Load Unity iPhone and create a new project (File > New Project…)
- When the Project Wizard appears, specify the project name and path, and make sure “CreateVisualStudioSolutioniPhone” package is selected. For the purpose of this example, I used “/Users/mryan/Development/Unity/Projects/Project1“.
- Once the project has been created, click on the CustomTools menu and select CreateVisualStudioSolution to automatically create the Visual Studio 2008 Solution. The solution is conveniently located in the “VisualStudio” folder beside the “Assets” folder within your Unity project. In this example, it was placed at “/Users/mryan/Development/Unity/Projects/Project1/VisualStudio“.
VMware Fusion Setup

VMware Settings
While you don’t need to share folders through Fusion settings, I prefer to keep them enabled so that I have easy access to my Mac OS X folders.
The image to the right just shows how you would enable or disable the shared folders. When the folders are enabled, they can be accessed in Windows Explorer via “\\VMWARE-HOST\Shared Folders“.
Symbolic Links

Explorer Symlink Comparison
Under VMware, Mac OS X Symlinks will not work under Windows unless you have enabled SMB sharing, and created an active folder share pointing to the VisualStudio folder in Unity Project.
When the Visual Studio project was created, a Symlink called “AssetsLink” was created. This link points to the “Assets” folder within your Unity project. If you access the VisualStudio through a non-SMB share, AssetsLink shows up as an ordinary file.
As you can see in the Explorer Symlink Comparison image at the right, the top Explorer window accesses the “VisualStudio” folder using AFP sharing via the VMware Fusion Shared Folders mentioned above (”\\vmware-host\Shared Folders\mryan\Development\Unity\Projects\Project1\VisualStudio“). The bottom explorer window uses SMB sharing via “\\SYSTEM\Unity\Projects\Project1\VisualStudio“, and the item “AssetsLink” correctly appears as a folder.
SMB Folder Sharing

System Preferences - Sharing
- Under OS X, open System Preferences, and click on Sharing.
- Make sure the “File Sharing” service is enabled by placing a check in the box to the left.
- Add a shared folder that points to either the newly created “VisualStudio” folder inside your Unity Project folder, another folder further up the tree. I have my share pointing to /Users/mryan/Development/Unity so that only one share is needed for all of my Unity iPhone projects.
- You can optionally remove the Users group, and set the Everyone group to have “No Access”.
- Click Options. When the panel appears, make sure there is a check beside “Share files and folders using SMB”. You should be able to leave the other check marks as they are, although if you continue to have difficult getting the AssetsLink to work, disable AFB Sharing. Click Done.
- Close System Preferences.
“The project location is not trusted”

Project location is not trusted

.NET Admin Tools
From within Windows, when you load the VS2008 solution or project file, you may receive a warning that says the project location is not trusted. I believe this occurs because the project is on a network share, and is considered less secure than the local file system.
To fix this, you will need to user the Microsoft .NET Framework 2.0 Configuration tool that is part of the .NET Framework 2.0 Software Development Kit. If you don’t already have the SDK installed, you should do that first.
- In Windows, click Start, click Control Panel, and then double-click Administrative Tools.
- Double-click Microsoft .NET Framework 2.0 Configuration.
- Expand the Runtime Security Policy node, the Machine node, the Code Groups node, and the All_Code node.
- In the right pane, click Add a Child Code Group.
- Choose Create a new code group, enter a name for the code group (e.g., “VS Development“), and then click Next.
- Choose a condition type of URL, and enter the UNC path to the share location of your project, using the format \\servername\sharename\*, for example \\SERVER\Unity\*. Click Next.
- Choose Use existing permission set and select FullTrust, and then click Next.
- Click Finish.
- Select your new code group, right click, and select Properties.
- Under the General tab, check the two boxes under the “If the membership condition is met” statement, then click Apply.
- Close the configuration tool, and reboot Windows.
Restart Visual Studio – You will now be able to open or create a project without “The project location is not trusted” dialog box appearing. However, you will not be able to Debug until you choose a zone for your partial-trust application
- From the Project menu, choose ProjectName Properties.
- In the ProjectName property pages, click the Security page.
- Select Enable ClickOnce Security Settings.
- Under Zone your application will be installed from, click the drop-down listbox and choose the zone you want to simulate the application being installed from. The Permissions required by the application grid shows all available permissions. The check mark indicates permissions granted to your application
- If the zone you choose was Custom, select the correct custom settings in the Setting column of the Permissions grid.
- Click OK to close the property pages.
Mapping a Network Drive

Map Network Drive

Mapped Drive
The last thing you should do is map a network share to a drive letter for convenient access. In the images at the right, you will see that “\\SERVER\Unity\Projects” is mapped to Drive P. This mapping allows me to very quickly access any of my Unity iPhone projects from within Windows.
Finished!
You should now be able to use Visual Studio to write and edit your Unity iPhone scripts.
At this point, you can just add files and folders to the AssetsLink folder in VS2008, and they will automatically appear in Unity. If on the otherhand, you add, remove, rename, or otherwise modify files in Unity, all you need to do to get VS2008 back in sync is to run the “CreateVisualStudiosSolution” once again. You may need to close Visual Studio before running that command, but the file updates will be there when it’s next opened.
No Comment.
Add Your Comment