Is it possible to add menu items to the OSX menu bar (file, edit, view, etc) from a plugin within Unity, and if so, where would one look (in terms of documentation or example code) to start on such a project?
Obviously, ideally, these menu items would also have some sort of callback to a function within Unity.
It probably takes some experimenting to get it right, and we may change the menu implementation in some future builds, but I'm sure it is possible right now.
This would of course only work in standalones, we don't support C plugins in the web player.
Well, I had to learn the basics of Objective-C first, but I got this to work, as well as system level alerts to work! Now just the callbacks and I'm ready for some basic app development using Unity!
It also appears you can modify the interface builder files directly by right clicking on the built Unity game, and selecting show package contents.
Contents->Resources->MainMenu.nib
However, I'm not sure if it's possible to poll these actions from within Unity, or at least not in as efficient a way. If there were such a method, it would be ideal.
However, if there are purely Cocoa interface elements to be added that don't need to interact with Unity (such as an about window), this can be done.
If you want to add menu items to a standalone game: that's easily not possible (right now at least). It should be possible with some hacks or good knowledge of the OS (see Jonas' answer for OS X case).
If you want to add menu items to Unity editor: use @MenuItem attribute in your script, and write small "bridge" code so that they call into your plugin.
It seems Jonas is correct, although it does require some knowledge of Objective-C, which I didn't have. I haven't gotten the callbacks working yet, but that should only be a matter of time. I look forward to when this feature is included in a simple way inside Unity!
Thanks, I'll give this a spin sometime this week!
– Brian-KehrerWell, I had to learn the basics of Objective-C first, but I got this to work, as well as system level alerts to work! Now just the callbacks and I'm ready for some basic app development using Unity!
– Brian-KehrerI implemented a basic polling method to check to see if anything has changed on the Cocoa side, since passing a delegate seems impossible. Done.
– Brian-Kehrer