Unity Plugins and UIApplicationDidFinishLaunchingNotifcation
I’m taking a break from my Cocos2D-related posts for this #iDevBlogADay entry. With that said, while this post will be talking specifically about creating Unity plugins, the knowledge can still be used to aid in creating standalone plugins for Cocos2D as well.
So you’re writing your Unity plugin to do some cool native functionality, but you really need it to do some work right when the app launches. There are usually two ways to solve this problem: 1) Create an “init” function that you call from Unity script when your first scene is loaded, or worse 2) modify application:didFinishLaunchingWithOptions: directly. Technically, there’s a third option too, involving creating a category of the AppController delegate and “overriding” application:didFinishLaunchingWithOptions:. The OpenFeint Unity plugin uses this method, actually, but as I mentioned in a previous post, this has some serious drawbacks, especially if you want to use the technique more than once (and yes, I realize I’m the one who originally wrote that plugin… I didn’t know!).
I’d like to introduce you to the UIApplicationDidFinishLaunchingNotification key, something which has become a good friend of mine.





