A better way to integrate Unity3D with a native iOS app

Integrate Unity 5 in a native iOS app with Xcode 7

Integrate Unity 5 in a native iOS app

A few months back I published a blog post about how to integrate Unity3D within a native iOS application.  This tutorial was written for Xcode 6 & Unity 4 and in the comments there were a lot of requests for a new tutorial.

Tonight I found the time to make the video tutorial on how to integrate Unity 5 in a native iOS app with Xcode 7, so I hope you enjoy it!

I hope this can help some of you guys out, because integrating Unity3D within a native iOS app isn’t that easy, but I’m really happy with the setup that I have right now.


The version of Unity that I use is 5.2.2f1 and Xcode 7.1.

Video tutorial: integrate Unity3D within a native iOS app

You can check out the video on Vimeo – Add Unity3D in native iOS application. If you have any questions, just put them in the comments, or contact me via Twitter. I hope you know understand how to integrate Unity3D within a native iOS app.

  • Pingback: A better way to integrate Unity3D within a native iOS app()

  • hardylr

    Thank you very much for the tutorial!

  • Lonson Huang

    This tutorial is amazing! We have tried it, integrating is success, but when we are a Vofuria Project, when we start the Unity, we just can see black screen, and we can’t find out the problem.Can u help?

    • Lonson Huang

      we r using Xcode7 and unity5.2

      • Babybet

        Hi, I faced your same problem. My problem was because when vuforia unity works before native integration, the “AppControllerClassName” is not “UnityAppController” but “VuforiaNativeRendererController”. So if we change “AppControllerClassName” to AppDelegate ,
        “-(void)shouldAttachRenderDelegate” in VuforiaNativeRendererController will not be called. Thats why my screen showed black. Check your Libraries>Plugins>ios. There is a file “VuforiaNativeRendererController.mm”. Comment “IMPL_APP_CONTROLLER_SUBCLASS(VuforiaNativeRendererController)”. Copy paste the “- (void)shouldAttachRenderDelegate” method to UnityAppController.mm. See whether it works.

        • I’ve added another solution in the comment above, in your version you will have to re-add the `shouldAttachRenderDelegate` every time you rebuild from Unity which can be a pain in the ass 🙂

          • Charles

            Hi Frederik! your tutorial are awesome .Could you do some extra tutorial after this about how implement vuforia? So many people want to do this. Will be very useful. Thank you!!!

          • I’ll see what I can do. At the moment I have a lot of other work which has priority right now.
            Maybe in the upcoming weeks I’ll try to make a Vuforia tutorial.

            Kind regards,

          • Carlos Osejo

            Hi, Frederik!!
            Thanks, this was very helpfull for me and my teammates for an important project using Unity, Vuforia, Objective C and Swift.
            As you said it will be great to have an complete tutorial of that, but I have a crazy idea, we create a project demo using your tutorial and maybe we can help you sending a video with final little steps for connecting with Vuforia and Unity. This can help you (time trouble for making it) and help other people that have the same problem as we have it.

          • Gary Siu

            hi Frederik any Vuforia tutorial for us?please …..

        • Charles

          Please I try to implement Vuforia, i have follow all steps of this video but i don´t know the steps to follow after this to makes vuforia works. Thank you babybet

      • Yeah with vuforia you have to remove the following line of code in the file



        Then you have to add de `renderDelegate` in your AppDelegate file.

        self.unityController = [[UnityAppController alloc] init];
        self.unityController.renderDelegate = [[VuforiaRenderDelegate alloc] init];
        UnityRegisterRenderingPlugin(NULL, &VuforiaRenderEvent);

        At the top of AppDelegate, you have to add the following line of code, right before the @implementation AppDelegate

        extern "C" void VuforiaRenderEvent(int marker);

        Kind regards,


        • Kevin

          Dear Frederik,

          Using your and Babybet’s suggestions I’ve managed to get my camera working. Unfortunately, nothing happens when I point it at the marker. Perhaps I implemented the Event part wrong?

          I’ve tried both the way you described as well as a equivalent for Swift (my project is in Swift), neither seem to work.

          Any ideas? Thanks again for your time!

          • Fábio Barreiros

            I’ve implemented Vuforia and it detects the marker but the screen is black, i’ve also implemented shouldAttachRenderDelegate but it’s never called

            #import "AppDelegate.h"
            #import "VuforiaRenderDelegate.h"
            // Unity native rendering callback plugin mechanism is only supported
            // from version 4.5 onwards
            #if UNITY_VERSION>434
            // Exported methods for native rendering callback
            extern "C" void VuforiaRenderEvent(int marker);
            @interface AppDelegate ()
            //Our navigation Controller for the Application
            @property (nonatomic, strong) UINavigationController *navVC;
            @implementation AppDelegate
            - (UIWindow *)unityWindow {
                return UnityGetMainWindow();
            - (void)showUnityWindow {
                [self.unityWindow makeKeyAndVisible];
            - (void)hideUnityWindow{
                [self.window makeKeyAndVisible];
            - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
                self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
                self.window.backgroundColor = [UIColor redColor];
                ViewController *viewcontroller = [[ViewController alloc] initWithNibName:nil bundle:nil];
                self.navVC = [[UINavigationController alloc] initWithRootViewController:viewcontroller];
                self.window.rootViewController = self.navVC;
                self.unityController = [[UnityAppController alloc] init];
                [self.unityController application:application didFinishLaunchingWithOptions:launchOptions];
                [self.window makeKeyAndVisible];
                return YES;
            - (void)applicationWillResignActive:(UIApplication *)application {
                [self.unityController applicationWillResignActive:application];
            - (void)applicationDidEnterBackground:(UIApplication *)application {
                [self.unityController applicationDidEnterBackground:application];
            - (void)applicationWillEnterForeground:(UIApplication *)application {
                [self.unityController applicationWillEnterForeground:application];
            - (void)applicationDidBecomeActive:(UIApplication *)application {
                [self.unityController applicationDidBecomeActive:application];
            - (void)applicationWillTerminate:(UIApplication *)application {
                [self.unityController applicationWillTerminate:application];
            - (void)shouldAttachRenderDelegate
                self.unityController = [[UnityAppController alloc] init];
                self.unityController.renderDelegate = [[VuforiaRenderDelegate alloc] init];
                UnityRegisterRenderingPlugin(NULL, &VuforiaRenderEvent);
                // Unity native rendering callback plugin mechanism is only supported
                // from version 4.5 onwards
            #if UNITY_VERSION>434
                UnityRegisterRenderingPlugin(NULL, &VuforiaRenderEvent);
          • Fábio Barreiros

            Ok i fixed it, you should call shouldAttachRenderDelegate from “UnityAppController+Rendering.mm” in callbackGfxInited

            In Classes > UnityAppController+Rendering.mm > line 72 callBackGfxInited

            replace the method callbackGfxInited by this:

            #import "AppDelegate.h"
            - (void)callbackGfxInited
            	_renderingInited = true;
            	[self shouldAttachRenderDelegate];
                AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
                [delegate shouldAttachRenderDelegate];
            	[_renderDelegate mainDisplayInited:_mainDisplay.surface];
            	[_unityView recreateGLESSurface];
            	_mainDisplay.surface->allowScreenshot = 1;
          • Charles

            Thank You!, i get this

          • Charles

            Thank you Fábio to your answers! But i have a problem with this line , could you know why happens this?

          • Charles

            Then You have to change something in AppDelegate.h and AppDelegate.mm? Your previous post with AppDelegate.h is correct?

          • Charles

            i Copy all like your code but i get this error in UnityAppController.mm

          • Fábio Barreiros

            Add you added the “shouldAttachVuforiaRenderDelegate” to your AppDelegate.h?

          • Charles

            This is my AppDelegate.h:

            #import “ViewController.h”

            @interface AppDelegate : UIResponder

            @property (strong, nonatomic) UIWindow *window;
            @property (strong, nonatomic) UIWindow *unityWindow;
            @property (strong, nonatomic) UnityAppController *unityController;

            – (void)showUnityWindow;
            – (void)hideUnityWindow;
            – (void)shouldAttachVuforiaRenderDelegate;


            This is AppDelegate.mm:

            – (void)shouldAttachVuforiaRenderDelegate {

            self.unityController = [[UnityAppController alloc] init];

            self.unityController.renderDelegate = [[VuforiaRenderDelegate alloc] init];

            UnityRegisterRenderingPlugin(NULL, &VuforiaRenderEvent);

            //Unity native rendering callback plugin mechanism is only supported
            // from version 4.5 onwards

            #if UNITY_VERSION>434

            UnityRegisterRenderingPlugin(NULL, &VuforiaRenderEvent);



            And the UnitAppController.mm:

            #import “AppDelegate.h”

            – (void)shouldAttachRenderDelegate {

            AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;

            [delegate shouldAttachVuforiaRenderDelegate];


            When te app runs and i touch “Show unity” log says:

            2015-11-20 14:59:55.999 Unity5Native[8398:3795519] [ViewController] Show unity button touched
            2015-11-20 15:00:02.639 Unity5Native[8398:3795519] [ViewController] Show unity button touched
            2015-11-20 15:00:03.269 Unity5Native[8398:3795519] [ViewController] Show unity button touched
            2015-11-20 15:00:03.771 Unity5Native[8398:3795519] [ViewController] Show unity button touched

            Thank you Fábio for your time!

          • Fábio Barreiros

            Iam not an objective c genius this is my first time Codding in ios but your first import it’s not with an error?

          • Charles

            Only first time that i have running the app it changed to UnityWindow. But only see black background

          • Charles

            Hi Kevin could you paste the code add to AppDelegate.h and mm? Thank you!

        • Robert Wendel

          Hi Frederik,
          thanks for this awesome tutorial. Helped me alot.
          I am now facing problems with integrating Vuforia, too.

          I did what you wrote here (you also have to rename the AppDelegate to .mm) and now I can perfectly see my camera image but tracking doesn’t work. nothing happens. no console log, nothing. do you have any idea?

          in my unity project my target is setup inside the imageTarget and the target is activated in my ARCamera as well.

          I’d love to see a Vuforia tutorial, too 🙂

          • Robert Wendel

            I got it to work now 🙂
            Just had to add the /Data/Raw/QCAR folder in Build Phases -> Copy Bundle Resources although I had it already in my Vendor/Unity/Data folder reference. So now I have my .dat and .xml of the image target twice, but hey it works

        • Daniela

          Is there a way to fix the black screen issue without having to change the AppDelegate to .mm ? When i do that, the CGLConfiguration from my GoogleMaps pod says ‘Use of @import’ when modules are disabled but Enable Modules is set on YES. Im feeling stuck between a rock and a hard place.

        • Соок Сок

          everything goes well but in the end i had this issue, can u help me ?

  • Jesse Smith

    Woot! Thanks Frederik. It worked! This is a great starting point for people trying to launch their Unity games from native apps.

  • Thorsten

    Great tutorial, thanks.
    I see in the video that you hide the unity window with “[self.window makeKeyAndVisible]”. How can I call this method from Unity? Or is there another way to cancel the Unity scene and go back to the native screen?
    Thank you!

  • Mohammed Hasen

    i all ready have the existing code with storyboard. i like to add the button i home page which it will redirect me to unity game. how can i achieve this?. thanks in advance

  • Charles

    This video tutorial will work with unity and vuforia project?

    Thank you!

  • Charles

    Hi people! I have follow all steps. I want to use Vuforia but when i compile get image error.
    Also i have commented line:

  • Charles

    Hi team. I have unity+vuforia same versions of this Tutorial. When i finish this tutorial i go to Library Search Paths (build settings tag) and i add folder where is libVuforia.a.

    Next step: I go to VuforiaNativeRendererController.mm and comment the line //IMPL_APP_CONTROLLER_SUBCLASS(VuforiaNativeRendererController)

    I don´t know what´s next step. I get allow permissions to Camera and when i tap to “ShowUnity Button” i get blackscreen.

    All help is welcome 🙂 Thank YOU!

  • Charles82z

    Hi people! I have an important project and i have so many problems to implement vuforia with this tutorial. Anyone get this? Could share the project will be very useful. Thank you!!

  • Elie Zananiri

    Thanks a lot, super helpful tutorial!

  • Andrew London

    Hrmm, I can’t get a build to run.. its always missing a header, every time i get “il2cpp-config.h” file not found

  • Prajeet Shrestha

    Lot of run time errors followed this tutorial step by step. Using it in xcode 7.2 and unity 5.3.0f4 . Also Can we have this video in youtube? 🙂

  • Prajeet Shrestha

    Lot of run time errors followed this tutorial step by step. Using it in xcode 7.2 and unity 5.3.0f4 . Also Can we have this video in youtube? :)1

  • Prajeet Shrestha

    1. Lot of run time errors followed this tutorial step by step. Using it in xcode 7.2 and unity 5.3.0f4 . Also Can we have this video in youtube? 🙂

    • Hi Prajeet,

      I’m uploading the video to Youtube as we speak (https://youtu.be/RUmrRHeS7BU). I can’t help you any further with your errors, as it is probably a build setting or so that is not correct.

  • Andrew London

    Thank you so much for this tutorial Frederik! I am having an issue trying to complete this tutorial with a Unity Project that’s using the Google Cardboard SDK. Specifically, I am getting Uncaught exception: NSInvalidArgumentException: -[CardboardAppController unityController]: unrecognized selector sent to instance 0x15f6c33b0.
    Xcode sees two AppControllers, the “CardboardAppController.mm” in the iOS/Plugins/ folder, and the “UnityAppController.mm” in the imported “Classes” folder… Any advice on how to merge or bridge the two?

    • Ushan Hattotuwa

      Hi Andrew, Did you find a solution to overcome this issue?

  • Sébastien Rottiers

    Hi Frederik !
    Great job, but do you managed to display Unity in a subview of the native window of an existing project ?
    For me, it works in a new “Hello World” project, but not in my real project, in this case the app crashes with EXC_BAD_ACCESS in UnityPreload 🙁

    • Hi Sébastien,

      Yeah I’ve used this technique in 3 live apps without any problem.

    • Andy Makely

      I am having this exact same issue. It fails inside UnityAppController::UnityInitApplicationNoGraphics, something wrong with the MountHandler/FileSystem?

      • Jayesh Tesla

        Hi Andy, were you able to find the cause for crash? I am facing the same problem right now. Thanks in advance!

      • Michael Tostenson

        Same problem here, any luck with this?

    • Jayesh Tesla

      Hi Sébastien, were you able to find the cause for crash? I am facing the same problem right now. Thanks in advance!

      • Sébastien Rottiers

        Hi Jayesh,
        Unfortunately not, and as it was a POC we decided to drop this integration 🙁

  • Alessio_Martinuzzi

    Hi Frederik, thank you for this great tutorial!

    All works well. I would to know how can I call my CSHARP class and relative methods or simply the “default” animations of the asset?

    My current error is:
    “Undefined symbols for architecture arm64:
    “_SpiderController__ctor_m6_0″, referenced from:”

    I’ve found this


    but I’m not able to integrate with your tutorial.


    • ravoori varan

      same issue while trying to add c sharp scripts to the unity code base and trying to build the xcode project. Could you please let me know incase if you find any solution for this.I am really facing a tough time to resolve this. Tried by chaning the scripting backend from il2cpp to mono2x and all other combinations in player settings. But none of them worked fine 🙁

    • ravoori varan

      Hey Alessio. I fixed these issues in my project.The issue was not with the unity,We have to re import the native class cpp files from the unity generated xcode project to our project and it would have been created those files for you.

      • Alessio_Martinuzzi

        Thank you ravoori for suggestions, actually I’m not working on the project of two month ago, but I remember I had fixed developing in mono2x

  • Jingyu Zhang

    Hi, Frederik. Great tutorial. You helped us a lot, really appreciate it.

    We could create a unityview window using unitygetmainwindow, and it worked fine.

    But unfortunately we failed to resize it or create a subview. We think we should use either UnityGetGLViewController or UnityGetGLView, however they never worked for us. We are Unity3d programmers, and quite new with IOS. Could you give us a hint?


  • Chema Iru

    Hello Frederik! First, i’m amazed that people do all this work and then care to share it. Hope i can do the same some day!

    This said, i am having the same problem that prajeetshrestha submitted about 20 days ago. The errors he show (and that i show too) seem to be pointing all to the foundation framework. I work also with 7.2 and the latest ios9.

    Can you tell us something about it? Some clue, as to where to point, not only “some build setting”, because theres a lot of build settings you made us change 😀

    Thank you very much again!

  • Brian

    Hi! I’ve been following the tutorial but I’m having some issues when it comes to compile and show the blue view. The error I’m facing is the following: ‘Unknown type name ‘UnityViewControllerBase” on UnityAppController.h on line 24. I workarounded this by commenting the import of UnityAppController.h in prefixHeader.h and doing it on AppDelegate.h, but, when I try to create the AppDelegate in UnityAppController.h the build fails with the following error: Use of undeclared identifier ‘AppDelegate’. What can I do?

    • Mike M

      Same problem here. I tried to move the #import into individual files but then I hit a problem when modifying the UnityAppController file to refer to my AppDelegate.h. I’ve triple-checked build settings and can’t figure out what’s different from the example. ARG!!

      Big thanks for the tutorial though, I’m so close!

      • William

        Hi, i managed to get it works.

        So, after i comment the #import “UnityAppController.h” line in PrefixHeader.pch and put the line #import “UnityAppController.h” in AppDelegate.h, I encounter the same problem (as stated above). I manage to solve it by using the method used in https://github.com/blitzagency/ios-unity5#adjust-the-getappcontroller-function-in-unityappcontrollerh. In summary (credit to blitzagency from the above url), I change the

        inline UnityAppController*GetAppController()
        return (UnityAppController*)[UIApplication sharedApplication].delegate;


        NS_INLINE UnityAppController* GetAppController()
        NSObject* delegate = [UIApplication sharedApplication].delegate;
        UnityAppController* currentUnityController = (UnityAppController *)[delegate valueForKey:@”unityController”];
        return currentUnityController;

        That way, it will point to the correct unityController without triggering the “Use of undeclared identifier ‘AppDelegate'”.

        I hope it helps and thank you very much for the tutorial!

        • A King

          Xcode Version: 7.3
          Unity runtime version:5.3.5f1

          I meet the same problem : “Unknown type name ‘UnityViewControllerBase’ blablabla…” too. And I follow your solution, it works, but we just need to do part of it.

          Step 1: Comment the #import “UnityAppController.h” line in PrefixHeader.pch

          Step 2: Put the line #import “UnityAppController.h” in AppDelegate.h

          then, I run the app, it works.

    • Federico

      I have the same problem: ‘Unknown type name ‘UnityViewControllerBase” on UnityAppController.h on line 24. So I also ave errors in UnityViewControllerBaseiOS.mm

      • Federico

        Cleaning project the errors in UnityViewControllerBaseiOS.mm disappeared. Still ‘Unknown type name ‘UnityViewControllerBase”. I tried William’s solution but it doesn’t work for me.

        • Mike Wang

          Replace UnityViewControllerBase with UIViewController, it’ll work now

      • Tats Taya

        have you solve this issue?

  • Sulo

    Hi bro! Thank u so much for this tutorial and i learnt a lot by this tutorial. But i have another problem and here it is. I used vuforia for my unity app. when i run the app it gets the following erro “library not found for -lVuforia” can u please help me. I want to integrate ar to an existing iOS app

  • Sulo

    Hi Frederik!
    Thanks a lot for this wonderful tutorial. But i’m having an issue to integrate a project which is using Vuforia for AR. So can u please add a new tutorial for Vuforia example.

    • Natasha Agarwal

      Hey, Where you able to resolve vuforia problem?

  • Juan

    Hi! Thanks for the tutorial, it is really good and useful, however I am getting a problem at some point. After modifying appDelegate and trying to running first time I got an error link and I cant figure out how to fix it… error is the following:

    Undefined symbols for architecture arm64:
    “RegisterStaticallyLinkedModulesGranular()”, referenced from:
    RegisterStaticallyLinkedModules() in libiPhone-lib.a(RegisterStaticallyLinkedModules.o)
    “RegisterAllClasses()”, referenced from:
    InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Any idea?? I have already checked when I export in Unity to set architecture: Universal and scriptingBackend to il2cpp

    Thanks a million in advance! 🙂

    • Annabel Teng

      Hi Juan,
      i have similar error as yours. You can try the following solution, re-add/add these framework in your project build phrases (link Binary with Libraries) Security, System Configuration or the libiPhone Lib.a in your libraries folder. I did this to solve the following error:
      ld: symbol(s) not found for architecture arm64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)

      (source from: http://answers.unity3d.com/questions/1110053/anyone-else-having-issues-with-53-and-xcode-72.html)

    • Renzo Gamero

      i have the same issue. did you solve it?

  • Соок Сок

    can u provide sample project pls

  • Соок Сок

    everything works perfect !!! thank you soooo much

  • 风南

    Hi! Can you share xcode project code?

  • Соок Сок

    I followed all of the steps and it works well. But my iPhone camera does not close while the app is running, and my phone is heating up because of camera. I don’t know how to stop or close the camera.

    CameraCapture.mm inside the Unity classes contains the following, but I have no idea how to call this method from my native ViewController:

    extern “C” void UnityPauseCameraCapture(void* capture) {

    [(__bridge CameraCaptureController*)capture pause];


  • Caesar

    Hi Frederik,

    Fantastic tut. And also thanks to all pre-posts.

    Now I can call Unity Vuforia Camera in native IOS but I have some issues to be fixed:

    1. When I launch iOS App, I found UnityWindow is shown in portrait by default without calling showUnityWindow() and native iOS window is shown in landscape (which should be portrait. Then I press the button to call showUnityWindow(), the natvie IOS window is gone.

    2. I integrate AR Vuforia as well, press button Camera view is ok but cannot track image target. I also tried /Data/Raw/QCAR folder in Build Phases -> Copy Bundle Resources. Also I am confused whether I need run script in latest version or not? Seems we directly copy Data to project so do not need it any more?

    3. Finnally when I test on my iphone via xcode, it always crashes at the beginning at point of extern “C” bool AllocateRenderBufferStorageFromEAGLLayer(void* eaglContext, void* eaglLayer)


    return [(__bridge EAGLContext*)eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:(__bridge CAEAGLLayer*)eaglLayer];


    The reason is showing as EXC_BAD_ACCESS, any idea?


    • star

      i have the same problem?have you solve it?

  • ravoori varan

    Hi Thanks for the tutorial. This is very much helpful to everyone like me, who is new to Unity.My only question is i already have an iOS app which has 10-11 views. And i want to present this unity view some where in the middle of the application for example in 5th screen. For instance user will be logging in and in the home screen i want to show a unity object in some part of it. please let me know how can i acheive this.

    • ravoori varan

      Also could someone let me know, how should i communicate with the Unity Player, for example if i want to execute some unity scripts on unity player,how can i achieve this from my iOS app.

  • Tien Nguyen Minh

    Hi, thankyou for the useful guide but when I build the project Unity5Native, xcode shows me the error:

    Undefined symbols for architecture arm64:

    “RegisterStaticallyLinkedModulesGranular()”, referenced from:

    RegisterStaticallyLinkedModules() in libiPhone-lib.a(RegisterStaticallyLinkedModules.o)

    “RegisterAllStrippedInternalCalls()”, referenced from:

    RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)

    “RegisterAllClasses()”, referenced from:

    InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)

    ld: symbol(s) not found for architecture arm64

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I use Xcode 7.2.1 unity 5.3.2f1
    Can you help me to resolve it? thanks!

    • Siddhartha Moraes

      Man, i have the same issue. Than i change my Machine. And this error was solved. I don’t know what is this.
      Probably this thing was related to my version of OS. Because my old machine have Yosemite e my new is the Captain.

  • jack


    I’ve been following the tutorial but I’m having some issues.
    how to fix it ?? Thanks

    • Jung Wook Hong

      I have Same Issue… is there anyone fix it?

    • Xinghua Zhu

      In the project Build Settings > Apple LLVM 7.1 – Warnings – All languages, change “Mismatched return type” option from Yes to just Yes

  • keyv

    I’ve made tutorial for Unity + Vuforia based on your videos and bunch of other sources,
    maybe it will be useful for someone


    • Pralo

      So, so many thanks!! you saved my day a lot!!

    • Sayyid Ahmad

      thanks for your tutorial, i am using unity 5.3.4 and vuforia 5.5.9 (for sample i am using vuforia best practices, Books) but when i integrating it, success, but the camera is blank, there is this message ini log:
      Could not find a UIView with CAEAGLLayer or CAMetalLayer layer class that responds to selector renderFrameVuforia

      • keyv

        well, I have the same unity and vuforia versions and used my tutorial a lot and everything works. Have you disabled Metal in unity project?

        • I have the same issue that Sayyid Ahmad has, but my camera open but the target cant be read… is there some config with vuforia on XCode to make it work properly ?

    • Dustin Bahr

      Thank you so much to the original author, and to keyv for simplifying the process with a step by step guide. keyv, your guide worked great for me! Since you did so well on this, I’m wondering if you have a similar guide for Android + Unity + Vuforia?

    • Renzo Gamero
    • Renzo Gamero

      i have an issue in camera capture.mm file. the issue is ” Use of undeclared identifier ‘static_assert’; did you mean ‘static_cast’?”

      in the line

      static_assert(countof(presetW) == countof(preset), “preset and preset width arrrays have different elem count”);

      i made the tutorial many times.

    • Eduardo Victorino M C

      Hello keyv , i follow your tutorial and all works fine!!!! thanks a lot!!! you are my hero!!!! lol , but i have a little problem, every time i show the unity window, the memory of the app rise in 10mb !!!!!! , any idea whats happenning?

  • Dipender Kaushik

    hi Frederik

    this is an awesome tutorial.

    I am trying to build a framework for my app so that other developers can integrate my unity project in their native project.

    Can you help me in figuring out how to make that process easier for them and the best way to build the framework in this manner.

    Thanks and all the help is appreciated

  • amazingw

    This article is awesome ,but there are some errors in unity 5.3.5f1 with xcode 7.3.1. But it is easy to fix.Thx nerd give us such amazing and useful article.

  • Renzo Gamero

    hello I have this issue. All appear in the same line.

  • Nguyễn Hải Long

    Hi! I’ve been following the tutorial but I’m having some issue when it comes to compile.
    The error I am facing is the following: “clang: error: unknow argument: ‘weak-ISystem’.
    What can I do? Please help me resolve this issue. Thanks!

  • Renzo Gamero

    i have the this issue and i re add all the frameworks, clean the projects . any other idea ?

  • Eduardo Santos

    Works good on Unity 5.4.0f3 and Xcode 7.3.1. How to launch it on a subview without being full screen? Very good tutorial :). Tanks in advance for the help.

  • Alexandru Pavalache

    I’ve followed this guide on point, 2 times in a row and I get the exact same linker issues.

    • guidomb

      Were you able to fix this? I am having the same issues only when I try to generate the project using simulator as the target SDK. If I generate the project for a Device everything works well.

      • Alexandru Pavalache

        We gave up on this approach and are now coding in Unity for the most part with the occasional iOS plugin, then we build for Xcode and test.

        • guidomb

          Just curious, were you generating the Unity project for the simulator target and building your xcode project against the simulator? Because that is how I am getting that error. If I set the player setting target SDK to device in Unity and then build the Xcode project using a device as target everything works.

    • Chayim Ehrman

      I had this exact same issue.
      The solution is in the Build Settings in other linker flags (OTHER_LDFLAGS) add: -Wl,-undefined,dynamic_lookup

  • Meh Sufalam


    This tutorial clear many things. Thanks for this amazing demo.
    After following all things. I’m getting following errors regarding “libiPhone-lib.a” framework.

    ld: library not found for -liPhone-lib
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Can you please help me to get rid on this?

  • Shaw Walters

    This is incredibly helpful.

    One question I’m sure a lot of people have (and that took me a couple of hours to figure out) is – how does one get back to the native view from inside of Unity?

    I’m sure you could figure this out in thirty seconds, but for the Obj C noobs who came looking for an easy integration–

    Create a .mm file and put it in Unity Project > Assets > Plugins > iOS

    Paste all this stuff

    #import “AppDelegate.h”

    @interface MyUnityPlugin:NSObject
    + (BOOL)hideUnityWindow;

    @implementation MyUnityPlugin

    + (BOOL)hideUnityWindow {

    AppDelegate *appDel = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDel hideUnityWindow];

    return true;

    //C-wrapper that Unity communicates with
    extern “C”
    bool uHideUnity(){
    return [MyUnityPlugin hideUnityWindow];



    Then make a C Sharp script called HideUnity, paste this code in and hook the hide function up to a button in UI 🙂

    using UnityEngine;
    using System.Collections;
    using System.Runtime.InteropServices;

    public class HideUnity : MonoBehaviour {

    [DllImport (“__Internal”)]
    private static extern bool uHideUnity ();

    public void hide(){
    Debug.Log (“Trying plugin…”);
    if (uHideUnity () == true) {
    Debug.Log (“Successfully returned data from external plugin”);


  • Ankita Korape

    Hello, i do exactly same what is in the video. But i get error in files where include path is defined, it gives error if path is defined with folder name . and when i remove folder name it solved error . Does it have any setting to include files with folder name ? Because if i have to do changes in so many files 🙁

  • Ushan Hattotuwa

    Hi, Thank you so much for this awesome tutorial. But I encountered a problem with orientation. My Unity project supports only landscape left and my native iOS app supports only portrait. But in my native project I’ve set the settings to support all 4 orientations and locked some of my views to only support portrait. But when I try to show the Unity window, it also opens in Portrait mode. Does anyone has a solution to this issue?

  • Eduardo Victorino M C

    I followed the tutorial and all works fine!!!! thanks a lot!!!
    But i have a little problem, when i show the unity window and then hide it, i have a memory leak of 10mb!!! so when i present the unity window like ten times , the app crash!!

    • Jayesh Tesla

      Hi Eduardo, did you figure out the fix for this crash? I am having the same problem right now. thanks in advance!

      • Eduardo Victorino M C

        Hi Jayesh!!!! , no!!! the issue continues! :(, fortunately the app doesn’t reach production environment yet…. lol

        If i find something, i will post it here!!!

  • Thibault Rolando

    Fantastic ! exactly What i Was trying to Achieve !

    Just one question,

    What about it I want the Unity Scene to start only when display the unityWindow ?

    IS there anyway to achieve this ? I dont know much about Objective C unfortunately !

    Aswel, once the Unity Scene start, how to create a button to go back to the original window ?

    Thanks a lot for your time 🙂

  • chengjun


    I exporting Unity app into framework, but It crashes at the following line,How can I solve this problem? https://uploads.disquscdn.com/images/850f9ea028e56562554a08ea38122413f678b6e98ac5abc81b4181f6e2e80e1e.png

    • Jitendra Rai

      Hi chengjun,
      did you find the solution for the above problem ?

  • Hi there, i have a repository on Bitbucket with another way to integrate and the final project to download.
    I made for my project and distribute e example project with tutorial.
    Glad if it help someone.

  • Nisha Parmar

    Hi i am getting use of undeclared identifier AppDelegate.h in UnityAppController file http://www.screencast.com/t/uJSkiny8tZ

  • Jose Francisco Castaño Narbona

    You rock man… Unity 5.4.3f and Xcode 8.1 and works

  • Julien Sanfilippo

    hi, i know it’s a bit old but i wonder if there are any swift (3?) version of this tutorial ?
    i’m currently facing the use of swift 3 library through Unity 5.5 and i’m completly lost

  • Would this work with Swift 3? The only issue I can see if the C++ integration.

  • 张伟

    Hello, whether the Unity of the project package into a framework of the form, integrated into the existing project

  • JP Longo

    Amazing guide, I do everything and remove all linker error. But now when I start Unity on my App, I get black blank screen and nothing more. Any idea ?
    I don’t use Vofuria.

  • Cyrus Sapand

    Can’t get it to work on Xcode 8. crashes when I add:
    [self.unityController application:application didFinishLaunchingWithOptions:launchOptions];


    • Michael Tostenson

      Same issue here, did you ever get anywhere with this?

  • vijay

    Hii, it working fine for me, what my query is?
    before i tapping on the background unity is running. I dont want like that when i tap on the button theonly unity should work.any suggestions please help me.

  • alessio crestani

    Someone has understand how to Close Unity when the controller with unityview disappear and restart Unity When the controller restart?