Hello,
I’m working on a VR mobile game made with UE4.21. I want to target the Oculus mobile, DayDream, WaveVR and Pico devices.
To do that I just have to enable the plugin I need and build the game. But for some SDKs, I need to use some specific code. If I disable a SDK, blueprint nodes and C++ are not yet available (obviously). So the good solution is to create an abstraction that call specific SDKs function.
For instance I want to do something like this:
I didn’t find a way to do it for our game - needed to create a separate branch for each.
In theory you might be able to separate all specific SDK functions into their own blueprints and you load the relavent project from git or whereever to build but I never tried it.
It is a pretty frustrating way the engine is setup handling mobilevr plugins. Better would have been for Epic to allow us to select which mobilevr plugin should be active when exporting
I found another solution which is IMHO more acceptable. I don’t use blueprint nodes of those SDK but instead I working on a big wrapper in C++ that exposes some nodes.
For instance the interface of my c++ looks like that:
int GetHandness();
bool Is3DOF();
string GetLoadedDeviceName();
Then in the sources, I just have to write something like that:
Finally in **MyProject.Build.cs **I can change the definition required to build my game, for instance,
Definitions.Add("OCULUS_SDK");
It’s not perfect because you’ve to:
1 - Disable and Enable the plugins for each platforms
2 - Edit the MyProject.Build.cs script and change the definition required to compile the project with the selected plugin
BUT it’s the best way found to work on a crossplatform project using the same branch.
It could be very very cool if the editor can provide a definition for each loaded plugins. Also a SDK selector could be the good solution