Posted by: Morten Nobel-Jørgensen | October 21, 2013

Creating a desktop plugin for Unity 4 using Xcode 5


Screen Shot 2013-10-21 at 16.51.11In this blog-post I’ll describe how to compile the RenderPluginExample for Unity 4 using XCode 5. The RenderPluginExample is described in “Low-level Native Plugin Interface” document in the Unity Documentation [Link].

Step 1. Download and unpack the RenderingPluginExample42.zip [link] from the Unity website.

Even through the Unity project will run when started, it will break when the bundle file (OSX dll) is rebuild.

Step 2. Open XCode project RenderingPlugin/Xcode3/RenderingPlugin.xcodeproj.

Step 3. Click on the yellow warning triangle to launch the migration dialog. Click ‘Perform Changes’ to migrate the project to XCode 5.x. (If you are asked to perform a snapshot then click Disable – not needed in this case).

Screen Shot 2013-10-21 at 16.31.54

Step 4. Open the project settings -> Build Settings and change the architectures to 32-bit Intel (i386) (Unity currently runs 32 bit. Universal or x86_64  build does not work).

Screen Shot 2013-10-21 at 16.46.02

Step 5. Open the file “RenderingPlugin.cpp” change the OpenGL include to:

#if SUPPORT_OPENGL
	#if UNITY_WIN
		#include <gl/GL.h>
	#else
        //was include <OpenGL/OpenGL.h>
		#include <OpenGL/gl.h>
	#endif
#endif

Step 6. Rebuild the plugin. Copy the RenderingPlugin.bundle file (right-click the file in XCode and select ‘Show In Finder’) to the ‘UnityProject/Assets/Plugins/’ – folder. Replace the existing file. Restart Unity (this is important – otherwise the old library file is still used).

Step 7. Open the ‘scene’-scene and press Play to see the plugin in action.

Screen Shot 2013-10-21 at 16.51.11

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: