Showing posts with label game. Show all posts
Showing posts with label game. Show all posts

25 June 2011

Developing iPhone Games with Unity on Windows

Unity is a fantastic multi-platform game maker. One of the most special things about it is that it is able to create games for the iPhone that can be submitted to the App Store. The problem is that this can only be done on a Macintosh machine.

The beauty of Unity is that the project files are saved in Unity's format that is later built for the platform (iPhone). The files can be transferred from a Windows machine to a Macintosh and then built for iOS.

If you're familiar with virtual machines, you probably know where I am going with this. A virtual machine will allow you to run a almost fully functional version of OS X on your Windows computer. So you can build a game with the free version of Unity on Windows, transfer the project files to Unity Pro on the virtual machine, build the project for iOS, test out on your own iPhone, send to Apple.

Visualized, this looks like:


Jus FYI, to build to an iPhone, the VM (virtual machine) needs to have Xcode installed but don't worry, we'll go over everything.

1. Install the VM on your Windows computer: http://techexxpert.blogspot.com/2010/12/how-to-virtualize-os-x-on-windows-7.html 

2. Now update the virutalized machine to OS X 10.6.7: http://techexxpert.blogspot.com/2011/04/updating-virtualized-os-x-1067.html

3. Install VMware Tools on the VM. This allows you to transfer files back and forth from the Windows machine. At the same time, it will allow you to go full resolution and enable sound on the VM: http://techexxpert.blogspot.com/2011/02/change-resolution-of-vmware-system.html

3. Now you'll need to install Xcode on to the VM: (you've already done steps 1 and 2): http://ipodtoucher55.blogspot.com/2010/12/installing-ios-sdk-and-xcode-on-windows.html

4. On your Windows machine and in the VM, download and install Unity: http://unity3d.com/unity/download/

5. Develop a game on your Windows edition of Unity. For now, I made a simple sphere with an animation. (Anything will work.)


6. Using VMware tools, transfer all the project files from Windows into the VM.


7. In the VM, open the project with in Unity.


8. Click File then Build Settings. Select iOS and click Build and Run.


9. The project will build create Xcode files in the project files. Open the .xcodeproj file.


10. Connect your device to your computer. In the bottom right of VMware Player, you should see an iPod icon. Right click the icon and click Connect. Make sure that your device is charging. If it is not, disconnect and reconnect. If that does not work, you will need to restart your VM.


11. Click the Organizer button to make sure that your device has connected correctly (green dot next to name).

12. In Xcode, you will need to change some build settings so that you can add it to your device. On the left side, click on the Unity-Project. In the middle column, click Unity-Project again. Click Build Settings in the center column. Make sure the settings look like the image below.


13. Do the same for Unity-iPhone targets, follow the image below.


14. In the drop down box next to Run, change to the first device next to Unity-iPhone. (This is your physical device).

15.Press Run. The app will be built and in a few moments afterwards, the app will appear on the home screen of your device.