3
\$\begingroup\$

I created an Android app for Gear VR in Java (using the GearVR framework) that I now want to port to Unity, so it can also be used for Microsoft's semi-new Mixed Reality headsets (for Windows; not HoloLens, though).

I've never worked with Unity (or C#) before, that's why I have a question:

How would you set up something like that? Can you simply create a single project and then put it on your (Android) phone/compile it on your PC depending on where you want to test it, or do you need separate projects for different platforms?

\$\endgroup\$
0
\$\begingroup\$

Can you simply create a single project and then put it on your (Android) phone/compile it on your PC depending on where you want to test it, or do you need separate projects for different platforms?

Yes, you can create a single project and build it for each platform you want to target. This is one of the major benefits / reasons to use a multiplatform game engine like Unity.

For a very simple project, this should mostly "just work" - you select your build platform from the build settings dialog and you're off to the races.

As you start using more platform-specific libraries, tools, input conventions, etc. you might need to expand on this with things like native plugins, conditional compilation, asset bundles, or custom build scripts to control what gets included in each platform, or abstraction layers to keep the bulk of your game code & content cross-platform.

Andrew Carvalho of Laundry Bear Games gave a great talk about how to do this type of platform-specific work at EGLX 2018 - I tried to capture some of the main points in a livetweet thread. Keep an eye out for the video of the session to get the whole story.

This work tends to be very bespoke for the type of per-platform adjustments a particular game needs, so if you find that you need more than what comes out of the box, you can post a new question here detailing the specific task you need to accomplish / build errors you're getting, and how you're trying to solve them, to get tailored help in making it work.

\$\endgroup\$
  • \$\begingroup\$ There may also be some differences in the android manifest if you want to support different VR setups (e.g. Oculus Gear VR vs. Google Daydream). I'm running into that headache myself right now. \$\endgroup\$ – Draco18s Feb 2 '18 at 20:08
  • 2
    \$\begingroup\$ If you have any tips to offer in an answer @Draco18s, I think that would be worth upvoting. I don't have any Android-specific VR experience to date, so I can't speak to those details myself. \$\endgroup\$ – DMGregory Feb 2 '18 at 20:45
  • \$\begingroup\$ I would...if I had the answers! Right now my project is in a state where it fails to compile and I have no idea what I did to break it. \$\endgroup\$ – Draco18s Feb 2 '18 at 21:52
  • \$\begingroup\$ I wanted to use Unity for Gear VR and MS's VR headsets and I probably do need one additional library but I have no idea if it's supported by both Android and Windows. So what you're basically saying is: Once you need specific additional libraries for different OS, better split the project into 2 to make handling everything easier... I already found the page you linked (but still thanks), unfortunately it doesn't really help with anything except building. @Draco18s What headsets are you developing for? The whole permission setup (Android vs. Windows) originally was my second question... cough \$\endgroup\$ – Neph Feb 5 '18 at 12:53
  • 1
    \$\begingroup\$ @Neph Gear VR and Daydream, which complicates my own problems because they're both Android apps. Someone made a clever little "change the manifest" tool for the project (before I got here) and I did eventually discover the problem I was having with my build on Friday (some resource files in the wrong place: thanks documentation! You were oh so helpful at describing where they needed to go). \$\endgroup\$ – Draco18s Feb 5 '18 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.