During this activity you're going to build your own virtual world in Unity 3D, put it on your Android phone, and then dive into it using Google Cardboard VR glasses.
- A PC or laptop for development (Windows, Mac or GNU/Linux)
- Visual Studio Code
- Unity Hub and Engine (installation instructions below)
-
git
see installation instructions - An Android¹ smartphone² with at least Android 4.3 or higher capable of running 3D games³.
- A USB cable to connect your phone to your PC
- Optional: Headphones / earbuds for in-game sound. Bluetooth is best, because you won't have to mess with a cable in an awkward location.
- Apple makes it very difficult to install a self-made iOS app to your phone. Therefore we cannot offer support for iOS during the BUK camp.
- If you have VR glasses and know how to deploy Unity apps to them, you can use that. The organisation of BUK Tech cannot offer support for this. If you bring your own knowledge or a knowledgeable mentor, you're free to bring your own VR glasses.
- If in doubt, try to install and run InMind VR. If that works, you'll probably be fine.
- Google Cardboard VR glasses. You will receive these at the BUK Tech VR activity.
- A wireless controller⁴ for your smartphone. You will receive one at the BUK Tech VR activity.
- This wil be a cheap bluetooth controller. Feel free to bring your own controller if you have one that you know works with your Android smartphone.
Follow these instructions to clone this repository to your local machine.
Switch to the oculus-quest
branch in Visual Studio Code.
Follow the section Enable developer options and USB debugging of the Android Developer user guide
Follow this set of instructions to enable Developer Mode on the Meta Quest.
Go to the Unity website and download the Unity Hub for your operating system.
Run the downloaded file and follow the instructions to install Unity Hub
Open the package and it should offer you to install Unity Hub
Extract or mount the archive and run the INSTALL.sh
script to install Unity Hub.
Note Unity Hub is installed in your local user account, you should not sudo
the install script.
Run Unity Hub from your system's application menu.
Log in with your Unity account, or register for one. You can register and login with your Google, Facebook or Apple account, which makes this pretty easy.
You might have signed up for e-mail spam by creating this account. Here you can unsubscribe from marketing e-mails. At the very bottom of the page is the checkbox to unsubscribe globally from all Unity related marketing e-mails.
Once you're logged in, you'll be prompted to install Unity. Install the latest 2020 LTS version (2020.3.32f1 at the time of writing). You will be prompted to accept the licence terms for the software and the free Unity Personal subscription.
Note: Unity received updates after the screenshots below were made, they show an older version number.
Once the download is completed, in the Unity hub left-hand menu, click Installs. You'll see version 2020.3.32f1 there. Click the gear icon in the top-right corner of that block.
You'll want to at least install Android Built Support, Android SDK & NDK Tools, and OpenJDK. This is necessary to be able to compile and install your game to your device. If you're using an Meta Quest, this applies too, because its OS is based on Android.
You'll have to accept the Android SDK and NDK License Terms from Google.
In the Unity hub left-hand menu, click Projects. Click the arrow on the Open button and select Add project from disk.
Then select the folder on your machine where you cloned this git repository.
In Unity Hub's Projects view, click the base game you added to launch the Unity Editor and load the project for editing.
It might take some time to download and install necessary packages.
If you press the play icon in the editor, you should enter the camera viewpoint in non-VR mode and can run around with WASD, look with the mouse, and jump using space.
Note: If you do this process the first time you might be prompted on the phone to accept the debug session from the PC.
Once the unity editor is open:
- Connect your phone to your PC via USB cable and unlock the screen.
- In Unity click File » Build Settings
- If Android is not selected, click Android and click Switch Platform, and wait for it to finish.
- In the Run Device drop-down, select your phone.
- Click Build and Run
- Save the app as
vr.tech.buk.apk
. - Wait a long time until the app opens on your phone
If everything went well, you'll be prompted to allow camera access and to scan a Google Cardboard QR code. You can click Skip instead of scanning such a code and it will load some default settings.
Now you should see two eye viewports that show the world and you can look around by moving the phone.
If you have a bluetooth controller that you can connect to the phone, you can probably walk around too.
Note: You can use the cross to exit VR mode, and the gear icon to scan a QR code.
To erase the world and build your own world:
- First erase the existing world: Delete the MAST_Holder object from the scene hierarchy.
- Click Tools » MAST » Open MAST Window
- In the MAST window, click the folder icon in the bottom left corner to load prefabs.
- Choose one of the folders in Assets/FSP/ folder. For example Modular Terrain and click Open
- Click one of the loaded prefabs in the MAST window to select it.
- Click in the world view to place a copy of the prefab.
- Now you can build your own world!
To change the height of the drawing grid, press ShiftW and ShiftS.
To rotate what you are drawing press Space.
To mirror what you are drawing press F.
To hide the MAST grid, press G.
You have reached the end of the starting tutorial. We are not finished writing this part yet!
You have reached the end of the starting tutorial. If you want to implement multiplayer into your games you can now follow our Multiplayer Tutorial
We're using MAST and the free modular assets provided by Fertile Soil Productions