Skip to content

[Community] Basic unity project and readme for BUK Tech VR at BUK Påskecamp 2022

Notifications You must be signed in to change notification settings

Joaveinz/buk-tech-vr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BUK Tech VR at Påskecamp 2022

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.

Requirements

  • 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.
  1. 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.
  2. 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.
  3. If in doubt, try to install and run InMind VR. If that works, you'll probably be fine.

Provided by us

  • 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.
  1. 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.

Clone this repository

Follow these instructions to clone this repository to your local machine.

Meta Quest 2 only

Switch to the oculus-quest branch in Visual Studio Code.

Checkout the oculus-quest branch

Prepare your device

Android

Follow the section Enable developer options and USB debugging of the Android Developer user guide

Meta Quest 2

Follow this set of instructions to enable Developer Mode on the Meta Quest.

Install Unity Hub

Go to the Unity website and download the Unity Hub for your operating system.

Windows

Run the downloaded file and follow the instructions to install Unity Hub

Mac

Open the package and it should offer you to install Unity Hub

Linux

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.

Set-up Unity

Run Unity Hub from your system's application menu.

Log in

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.

Optionally unsubscribe from marketing e-mails

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.

Install Unity Editor

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.

Install build platform support

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.

click the gear icon

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.

add android build support

You'll have to accept the Android SDK and NDK License Terms from Google.

Add the base game

In the Unity hub left-hand menu, click Projects. Click the arrow on the Open button and select Add project from disk.

add this project from disk

Then select the folder on your machine where you cloned this git repository.

Edit the base game

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.

open this project for editing

Play in the editor

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.

Build and run the game

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:

  1. Connect your phone to your PC via USB cable and unlock the screen.
  2. In Unity click File » Build Settings
  3. If Android is not selected, click Android and click Switch Platform, and wait for it to finish.
  4. In the Run Device drop-down, select your phone.
  5. Click Build and Run
  6. Save the app as vr.tech.buk.apk.
  7. Wait a long time until the app opens on your phone build the app and run it on your Android 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.

blank vr game

Note: You can use the cross to exit VR mode, and the gear icon to scan a QR code.

World building

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!

MAST Hotkeys

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!

The End

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

Attributions

We're using MAST and the free modular assets provided by Fertile Soil Productions

About

[Community] Basic unity project and readme for BUK Tech VR at BUK Påskecamp 2022

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 90.0%
  • ShaderLab 9.2%
  • Other 0.8%