Calling UnitySendMessage requires which library on iOS?

Hi !

I have made a plugin for unity->iOS communication, it worked perfectly and now I'm working on answering from plugin to unity via UnitySendMessage function. I want to build my plugin in a separate project, as it intended to be.

I tried to link two libraries into my plugin found in /Applications/Unity/Unity.app/Contents/PlaybackEngines/iPhonePlayer/iPhone-Trampoline/Libraries/

libiPhone-lib-dev.a

libiPhone-lib.a

The code linked but it crashed the my app.

I need to invoke this function:

Calling C# / JavaScript back from native code Unity iOS supports limited native->managed callback functionality via UnitySendMessage:

UnitySendMessage("GameObjectName1", "MethodName1", "Message to send");

So the question is: -Which headers do I need to include? - Which libraries do I have to link?

UnitySendMessage is in libiPhone-lib.a, and as far as I can tell, the Unity folks don’t include any header that declares it.

I just added the following to my code

extern void UnitySendMessage(const char *, const char *, const char *);

If you look at the generated AppController.mm, they basically do the same thing for the various UnitySendXXX functions, rather than including a header.

Having said that, while you will be able to build a library that calls UnitySendMessage, that library probably won’t work unless it’s linked into a Unity project, since UnitySendMessage is going to require more than just libiPhone-lib.a to actually work.

well the SendMessage method is in the GameObject Class wich is in the UnityEngine.dll file i think thats all you need to use hope this helps