Game Dev Blog

  • Thinking about making Gear VR and Cardboard work together sounds very easy in theory. All you need to do is turn off all the Cardboard scripts and turn on Virtual Reality Supported inside Unity player settings. Well, after almost eight hours of trying different things it didn’t pan out the way I had hoped, but I’m going to make it easy and explain what to do to get it working.

    The first part is to get the plain stereoscopic camera to work both in Cardboard and Gear. Instead of manually checking and setting different game objects active or inactive it is much easier to make an editor script to do the work for you with the click of a button. So, to make an editor script you create new C# script inside a new folder called “Editor” and make sure it doesn’t extend monodevelop and is using unityeditor. You can get rid of the Update and Start functions. You should have an empty class just like the one below.

    1. using UnityEngine;
    2. using UnityEditor;
    3. public class ExampleEditorScript{
    4. }

    After that you can tell it what you want it to do. Right now we need it to turn on/off cardboard features and virtual reality support. I’m sure you can handle that, there are just a couple lines of code that caught me for awhile. The first is how to put a menu item on the main menu bar in Unity, which is shown below.​

    1. [MenuItem(“Main Menu Example Item/Example Button”)]
    2. static void ExampleButtonFunction(){
    3. }

    The next thing is telling Unity that you want virtual reality, which is easy. All you need to do is call PlayerSettings.virtualRealitySupported. After that it is important to set the Cardboard and CardboardHead scripts to stop vr and head tracking. Getting those are easy enough, just do regular GameObject.Find for each of them. Set the variables you want changed. Then the tricky part is updating them. You have to tell Unity that those variables updated in order for the changes to hold.

    1. EditorUtility.SetDirty();

    That code tells Unity to set the variables, just make sure you pass in the cardboard and cardboardHead objects. And there it is, just click a button and build to either Cardboard or Gear VR. Now, you are probably asking yourself, “Why did he spend eight hours on this?” Well, making the stereoscopic rendering to work is the easy part. The hard part is getting gaze input to work together, which I’ll save for the next post. I will say one thing about it though, do not expect it to work in Unity beta.


  • Attending Boise Code Camp this year gave me some great ideas for further development. It’s always an inspiration to visit community events like these and learn new things. The most interesting sessions I went to were Making 101, OpenCV(Open Computer Vision), and IOT(Internet of Things) on the cheap.

    Creating things like light switches, garage door sensors, and water sensors then connecting them to your phone over the internet was the topic for IOT on the cheap. It gave me some good ideas for components I already have lying around. I’ll have to brush up on my Java skills if I want to make my own Android app, but there are some frameworks that I could use to make things easier.

    OpenCV really had my mind going. The person giving the presentation made an application that showed the web cam and on the side it had several different processes that you could select and visualize. The one that intrigued me the most was called Harr. After feeding it a couple hundred pictures of objects that you want to track it would be able to highlight those objects in the camera. It is most popularly used for face detection, but I have other ideas for it.

    Overall, I had a great time going to the camp. I learned some new things and got loads of inspiration. There were some boring sessions that I wish I would’ve skipped, but that’s all part of it I suppose. Next year I plan to present my own session for VR game development using Unity. And hopefully I will also host a game jam the night after code camp.

  • After the long days of development followed by the release of a game I always find myself in a low. It’s a mixture of mostly boredom and a little sadness. This thing that I’ve spent so much of my effort on is now published for people to either ignore or enjoy and now I have nothing to do. No matter how miserable I feel for those couple days I believe it has it’s purpose. I have found my mind wandering and coming up with several ideas for new games. So, today was the end of that boredom. I have started to conceptualize a game about tower defense in VR.

    I know tower defense games are a dime a dozen but I believe I can put a fresh spin on it, especially using VR. So, here is to the next several weeks of programming. Here is to continued artistic creation. Here is to not feeling that boredom haze.