- Home /
NSNotification in Unity plugin
Hi,
I'm currently converting a cocos2d plugin into one that can be used in Unity3D. The plugin currently uses NSNotifications to call functions and trigger events. Is there a way to parce these notifications so that I can use them with unity? Preferably c#?
Thanks
Answer by VolureDarkAngel · Aug 25, 2013 at 07:10 AM
You would need to build a listener for the plugin. And callback to unity via
UnitySendMessage() message.
This is a linked message that is defined in libiPhone-lib.a and will be linked during final compile.
if you build the iphone target once you should be able to open the project.
In the project you will find "iPhone_target_prefix.pch"
That is where the function is defined. If you duplicate that definition in your plugin you should be able to use it as well.
Bear in mind that the call will only work when you compile it into the game, and will likely not work when building it into your own test projects.