Upgrading KittenVR to Unity 5.1

Blog Posts ,Programming ,Software ,Unity ,Virtual Reality
June 19, 2015

Last week, I set off on a mission to tidy up how Events were handled in KittenVR – leading up to 0.1.6, all of the raycasts were done by hand and there was a lot of specific logic separating out the non-VR mode and VR modes. I also had hardcoded the OnClick() behavior within one behemoth (okay, this is slightly exaggerating, but it was kind of getting messy) class attached to the Player controller.

Midway through a debug session with an Event System (more on that later) I decided to wait until I had a chance to upgrade the entire project to Unity 5.1, since there were a bunch of improvements to help with AR and VR implementation in the latest version (you can check out the full release notes here). This blog post is a list of the things that I ran into with the upgrade, and what I did to mitigate them.

First things first: If you’ve poked around in the source code of KittenVR at all, you might have noticed how I had created two different scenes for VR and non-VR player controllers. This was never meant to be permanent, but I was holding off on cleaning this up until the 5.1 release. Once I imported the project into 5.1 (after several attempts – it hung on “Compiling Scripts” twice and I had to kill from Task Manager) I popped open the VR scene and noticed that the OVR scripts were throwing some errors – which makes sense, because Unity 5.1 has built-in VR support and has changed some stuff from the old controller scripts.

Right after I noticed this error, I realized that this was the perfect opportunity to upgrade to one unified scene and fix the Event System all in one, so I opened up the non-VR scene and decided to get to work from there… and it didn’t work at all.

First, the scene was just generally messed up – the terrain I had put in was in a wonky spot, and just seemed like it had been modified from the 5.0 version, but that was a minor thing easily corrected by moving the objects around. The bigger issue was the first hurdle in upgrading my project.

When I went to run Kitten–, I was presented by a nondescript grey screen of nothing in the editor play window. I promptly realized that this was the result of one of my GameObjects going missing – the FPSCharacter controller.

For some reason, updating to 5.1 had messed up my Standard Assets package, removing almost everything except for a few scripts. No idea why, but a “quick” reimport of the Standard Assets package from the Asset Store tidied this up. I wish I had realized the package was corrupted before I deleted the non-existent one with scripts setup, but c’est la vie – it was easy enough to get the Character Controller back up and running.

To be perfectly honest, clearing up those two things were the only part of the upgrade that I had to do anything with. Just this week, I upgraded to a new desktop, computer, so I haven’t been able to test out the VR performance and behavior (Unity 5.1 has a checkbox for enabling VR mode that generates a direct-to-Rift .exe) but it will be awesome to have one scene and clean out a little bit of what KittenVR has right now.

I’m going to be honest – I was kind of expecting more issues since I ran into several going to 4.6 to 5.0, but those were mainly it. I had a hell of a time getting my raycasts working again, but that was my own fault misinterpreting inputs and how to use Event Systems that resulted in a lot of excess code that I had to revert from. Ouch.

Some of the things I’ve noticed from 5.0 to 5.1:

1. My WebGL build looks much cleaner. It also loaded up in Firefox amazingly fast, but that might be a result of the substantially more powerful PC that I now use. It’s my first desktop purchase since 2011 and it is simply stunning… or at least, it will be once the graphics card gets here!

2. The WebGL beta is still a bit buggy. The graphics look a lot better, but there’s a specific bug I ran into with my Xbox inputs that only repros with the Mouse Y input using the right joystick. If you’re curious, keep an eye out on the GitHub link, which I’m updating as I find out more information. This doesn’t occur with a plain Windows build, so something seems to be getting lost in translation. The Mouse X joystick input works… kind of, it’s not consistent or smooth. Again, only repros on WebGL, but that’s in beta so it’s to be expected.

3. I’m getting a few strange console errors that don’t seem to mean a lot. This generally has to do with my plugins, but it’s not entirely clear why – it’s an error that doesn’t prevent running or building KittenVR, and when I go to the folder it shows, I don’t actually see the duplicates it claims I have – but I’m not entirely worried about this until it presents a real issue.

As I experiment more with the VR side of 5.1, I will be sure to update accordingly. You can also expect a post on what I did to hack together Xbox controller input – so stay tuned!

 

Related Posts

Leave a Reply