My team is currently porting a game for Moonlight. For this purpose we plugged our game with the VRLib by using the UnityPlugin.cpp as a basis. Even though our game doesn't use the Unity engine, we simply replaced the calls with our own engine's update/draw calls and it worked fine, we got our game working with the timewarp and the sensors !
We'd like now to implement the Oculus Menu when the user longpresses the back button. If we go by the Unity samples, it seems like the menu should be implemented by the game. However, the VRNative samples instead use the VRMenu classes and it seems to work almost out of the box. However to use the VRMenu you need to use the App class, which Unity doesn't use !
Is there a reason why UnityPlugin.cpp doesn't use the App classes ? Would subclassing my Activity into a VRActivity so I can use the VRMenu the right way to go ? Or should i try to implement the VRmenu inside the UnityPlugin.cpp ?
If I understand correctly, the issue here is that you based your code off of UnityPlugin.cpp rather than App.cpp, which lacks VRMenu integration, and VRMenu itself has dependencies against App.cpp, so you can't just pull it in. Is that correct?
My read of the code (which is cursory) is that UnityPlugin.cpp exists because Unity itself already defines its own NativeActivity that the Oculus SDK must augment. Non-Unity apps are expected, I think, to use App.cpp as their base. In your case, since you've built your code without App.cpp.
Can you tell me a little more about why you built it this way? Do you have your own base activity implementation?
The reason why we decided to use UnityPlugin.cpp is because it was the easiest way to get our game working with Oculus, with almost no change required in the structure of our app. Though we have our own base activity implementation, the engine we use plugs its own SurfaceView so we were a bit reticent with that approach. We will however try subclassing VRActivity. I'm still wondering how people with Unity will implement that menu, if something is planned for them, maybe we won't need to change our codebase.
I'm not sure that subclassing VRActivity is going to help you much if you don't take App as your native base as well, but please post about how it goes.