Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've passed last 2 days reading articles and book for understand how can i make a plugin for iOS in Unity. Basically i need just a demo for understand how it work. For now i've tried to make this process (with really poor luck):

I've started a new project in Unity and writed a simple script

using UnityEngine;

using System.Collections;

using System;

using System.Runtime.InteropServices;

public class CallPlugin : MonoBehaviour {

    [DllImport ("__Internal")]

    private static extern int test();

    void Start () 





Then i've created a project in Xcode with this simple script:

extern "C"{

    int test()


       int che = 5;

        return che;



Then i've tried:

to put the .mm and .h in the Assets/Plugins/iOS = nothing

to build the unity project and than add the .h and .mm in the Xcode project = nothing

In Unity i will always get the EntryPointNotFoundException, so unity see the file but is unable to reach the method. The problem is... how?! :)

Maybe i miss something or i've done something wrong? Thanks a lot for every help that you can give me :)

share|improve this question
up vote 7 down vote accepted

Ok, after reading a lot i've found the solution:

Seems that the extern call don't work inside the editor or simulator, so the correct way of doing this is develop for device (after putting the header and the implementation files under Assets/Plugins/iOS).

I hope that this will help some one :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.