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 :)


1 Answer 1


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 :)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .