It seems like few people are using native plugins as often as I am, but I was very excited about the RenderPluginDelegate addition in Unity 4.3. I was a little disappointed when I started playing with them, to realize that the built in delegates don't actually get connected anywhere by default. I have a few plugins which I hope to use as delegates, and so I decided I needed a common interface for them. My hope is that other plugin developers will use it as well, so that we don't end up with another PostProcessBuildPlayer. I constantly run into issues of plugins conflicting with each other. However, diagnosing conflicted PostProcessBuildPlayer issues would be much easier than diagnosing conflicting RenderPluginDelegates. I'd like to avoid all that and have something that many people can use to register their plugins. It will deal with the initial delegate registration and sit between other plugins and Unity, dispatching events seamlessly. It's current iteration is very simple, and inherits directly from the supplied RenderPluginArrayDelegate example. Hopefully it will be of use to some people. Take a look here: https://github.com/scarlet/RenderPluginManager
well, we are still bottlenecked by our web team to push samples on learn site, but for now lets have some docs right here ;-) we actually DO have a way to register render plugin without touching trampoline. Also, your way of doing stuff is flawed in a way that you cannot know in advance the needed order of plugins (and if you dont care you should just use this list thingy). As for registering itself: 1. in UnityAppController interface you will see field which will contain one plugin delegate. To repeat myself - if you are dependent on order (most of the time) - you implement your own delegate which calls stuff in needed order. Otherwise you can push ours RenderPluginArrayDelegate there. 2. at same UnityAppController which is called in GfxInited_UnityCallback (right after unity inited its graphics system) the code is like that: so the preferred way is to simply inherit your own appdelegate from ours: sure, i'm not saying that you should drop your code ;-), it is just we provide lots of stuff already so you can per-use it
Yes, it does assume that order is irrelevant. It's just based off the sample array delegate. Assuming enumerateObjectsUsingBlock calls the selectors in order (which it probably doesn't) you could force an order by registering a specific way. Though, that's not a good solution at all. The intent was to avoid getting in the way as much as possible, while providing an easier plugin registration process. The two biggest reasons I did it this way are: - Plugins may not exist at startup, or be needed all the time. If they're not around, they miss the reference to the display surface. This is just a tiny extension to the built in implementation. - Avoid touching/subclassing UnityAppController, as some plugins edit it directly (Vuforia in particular) But yes, I somehow totally skipped over the shouldAttachRenderDelegate method when sorting through the code haha. Whoops.
good point, we need to look into simplifying this well we hope people to move out of editing appcontroller (and we spoke with vuforia guys about all that, so they might switch soonish). As for subclassing i dont see why you are so afraid of that ;-). If you check comments in AppController - we have specified all the constraints and what you want to implement for what. Sure, poke me if something is missing non-obvious, but for future we expect users to subclass our controller to tweak the behaviour and never changing trampoline itself
Hi Alexey. Thanks for detailing the use of RenderPlugin. I actually spent two days just figuring out how this can be done since the plugin page does not talk about adapting IOS native rendering, and despite the AppController code suggest there is something it is not documented. I am glad to finally find this page but I blame your web people for preventing this doc to be available, in my opinion it should be available at the same time the code is released, or at least a temporary page should be provided at release, this brings a lot of confusion, I hope you give the message to your management. Anyway, I will need to do this as well for the Android side and was wondering if there is similar capabilities on the Android side before I spend a week trying to find it
Alas, no. As in - we are thinking about doing smth like trampoline for android too but this is just hand waving for now. So no - this is very ios specific at this point
Has there been any update to the documentation on trampoline plugin interface for ios? I've been looking around quite a lot trying to get some understanding, but this thread is still the most informative source of any info on trampoline in general.
Hey guys. Hate to revive a quiet thread, but @Alexey I have a question: what happens when more than one plugin needs to receive render events? OpenCV and NatCam are two such plugins that--with your current implementation--must subclass the UnityAppController to register render delegates. The blatant problem here is that only one such subclass of UnityAppController will be used. It would be great if you guys can redesign this part of Unity iOS to avoid such a clash.