Your first Cardboard VR experience in Unity 3D

Promotional shot of Ready Player One movie, go see it if you’re excited about VR potential!

Technology choice

  • I’m a .NET developer and Unity3D scripts are written in C#. Later it turned out that for a simple project like this one, you need to write exactly 0 lines of code
  • it allows to create 3D scenes in an accessible manner, even for someone who doesn’t have a lot of experience with this kind of designing
Blank Unity scene
Adding 3D objects in Unity
  1. Select Cube by clicking on it and:
    a) change it’s position to (X: 0, Y: -1, Z: 0). The camera will be located at (0, 0, 0), so in order to put our ground under the camera, we change the Y to -1
    b) change it’s scale to (20, 1, 20) to make it bigger
  2. Select Sphere and change it’s position to (0, 5, 5). We set Y to 5, so it’s 6 units above the ground (Cube element) and Z to 5, so it’s in front of the camera
  3. Select Main Camera and move it to position (0, 0, 0). CardBoard SDK is also moving the camera to (0, 0, 0) automatically, so it’s good to see in the Scene view where are all the elements located in relation to the camera
  1. Select the sphere
  2. In Inspector click “Add Component” and select RigidBody. This component basically adds physics to our object.
  1. Right-click in the Assets pane in the bottom
  2. Create -> Physic Material. A new object will be created, name it “BounceMaterial”
  3. Click on it and set the Bounciness property in the inspector to 1.0
  1. Open Build settings (it’s an option in File menu, top bar)
  2. At the top of the Build settings window, there’s list of your scenes. If you followed this tutorial, you’ll have only one there. Make sure it’s selected
  3. Below you should see all possible deploy options. The default is for pc/mac machines. We need to deploy to mobile, so pick either iOS or Android. Then, after selecting, click Switch platform button. This operation will take a while.
  4. After the popup with loader disappears, we need to configure iOS/Android project. Click Player Settings button, which is located next to Switch platform. Player Settings will appear at the right side, play with them a bit to change properties like the app name or minimal OS version
  5. There’s some additional configuration needed if you want to run the app on iOS:
  • Ctrl: for changing the roll of camera
  • Alt: for changing the Yaw and Pitch of camera

Solutions to random problems

  • my project built once for iOS, but doesn’t build again without error
  • when running the scene on iOS, views for eyes seem to wrong/shifted
  • I see black output in my phone, even though everything looked okay when clicking the play button in Unity

Questions, problems?



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michał Żołnieruk

Michał Żołnieruk

Full stack NET developer based in Berlin. Interested in VR, data analysis and tons of other stuff.