Day 44 of 100 Days of VR: Getting the Final Version Of Our VR FPS Game

Josh Unity VR Development 1 Comment

Here we are. 43 posts in on the 100 Days of VR challenge and 4 + 1 (this) posts about VR, we have a grand total of 48 posts. Wow, we’ve come a long way!

On the day before, I decided that I’m done practicing working with Unity in the simple VR FPS shooter. The original plan was to go and try and make my own game to publish, but I think I’ll detract from that goal. Instead, I’m going to focus on learning more about VR.

I’m going to experiment with more in-depth topics like player movement and player controller on mobile devices.

Now, let’s move to the main topic of this post! Getting our VR FPS game that we created from GitHub!

Downloading the FPS VR Example

Here’s the repo for our game: First Person Shooter VR

The root directory is our FPS before we made our VR changes. The folder: FPSVR is our game after.

To open this project. In Unity:

  1. Go to the menu and select File > Open Project and select the FPSVR folder

From this point, we have our game running in Daydream.

As a refresher the controls for playing the game in the Unity Editor is:

  1. Alt + mouse movement – Rotate around in the game to help us simulate looking around with our head in VR.
  2. Shift + mouse movement – Moves the gun around acting to help us simulate a Daydream controller.
  3. Shift + Left click – Fire bullets from our weapon.

Now, what if we want to play our game in the Google Cardboard?

Don’t worry. I’ve thought of that!

Switching from Daydream to Cardboard

In our game hierarchy right now, MachineGun_00 (1) which is a child of GvrControllerPointer is connected to our scripts.

However, we have another machine gun asset: MachineGun_00 which we use for the Google Cardboard. Instead of switching every single time, let’s just disable MachineGun_00 and move around MachineGun_00 (1) instead.

  1. Select MachineGun_00 (1) which is a child of GvrControllerPointer and drag it to be a child of the Main Camera, specifically so that it’s the sibling of
  2. Disable
  3. Re-enable GvrRecticlePointer

Now with this, we should be able to play with our Cardboard setup on Unity again and have our gun be static in the game again.

The controls are:

  1. Alt + mouse movement – Rotate around in the game to help us simulate looking around with our head in VR.
  2. Left click – Fire bullets from our weapon.

There isn’t much difference, the only thing that changed is that we no longer have the Daydream controller option.

Deploying the Game to Android Devices

If we want to try and play the game on our devices we have to change our PlayerSettings.

Technically, for those of you are reading this in the future, we could just deploy the game after we make the changes as a Daydream app the game should work as intended.

However today, Daydream compatible devices are a minority, so we must change some settings in PlayerSettings.

  1. In XR Settings, change the supported Virtual Reality SDK to be Cardboard instead of Daydream
  2. In Other Settings, change Minimum API Level to be 19 from 24

With this change in. We can now deploy and play the game in a Google Cardboard in most phones!


That’s it! Now we can switch back and forth between the Daydream and Cardboard for our game!

Like I’ve mentioned in the beginning of the article, I’m going to start working more in-depth with User Experience (UX) in VR.

What this means is that we’re going to work on:

  • Different VR movements implementations a
  • Different controller implementations!

We’re going to spend a couple of weeks working on this and I’ll see what we will do from this point on!

Subscribe To Our Weekly Newsletter!
Like these coding articles? Join my mailing list for the latest updates and influence the code that I write!
We hate spam. Your email address will not be sold or shared with anyone else.

Comments 1

Leave a Reply

Your email address will not be published. Required fields are marked *