Tag: Debugging

Unity Debug Diaries: Camera Glitch in Unity VR

I have been doing a bunch of VR work lately and working with the Gear VR in particular. The Gear is actually a nice piece of kit and I can’t wait to get my hands on the Oculus Go coming out… soon. As of this post, the Gear VR has the largest market penetration of any VR headset. One bug that I encountered that was tricky to nail down, was an optical glitch when moving from one part of my app to the next. It looks like an uninitialized RenderTexture, different every time and with glitchy artifacts everywhere.

Turns out the culprit was render scale, now known as XRSettings.eyeTextureResolutionScale. ETRS (because I’m not typing it out every time) is great for getting “free” anti-aliasing on everything in your scene. It basically renders at whatever ETRS is set to (eg:1.0, 1.2) and then downscales to 1 for the final blit. Since its a downscale (bilinear I think), its best never to exceed 1.5 or things will start to look crunchy. If you just want to downscale, use XRSettings.renderViewportScale, which is way cheaper than ETRS. It can only accept values from 0 to 1, hence downscale. By doing this, you would trade visual fidelity for performance.

Back to the issue at hand, changing eyeTextureResolutionScale at runtime will cause a new texture set to be made for each camera, and those textures are uninitialized. That means that it has been allocated space in memory, but whatever was occupying that memory is still there. This creates the weird memory artifacts that you see for…

Unity Debug Diaries

Unity Debug Diaries: Radically long load time on Kindle Fire HD

One of the most useful things in day to day game development is to know about those weird gotchas that you find in any complex tech. On top of that, you need to remember said gotchas the next time you encounter them. When developing cross platform games at a fast pace, I have solved problems and completely forgotten the solve the next time I bump into it six months later. Debug Diaries is my first attempt at trying to curb this. When I am faced with a weird problem, I am going to try to fix the problem while writing about it so that I can remember and hopefully, help you too. Here goes…

On doing the Amazon port of our soon to be released game, Thunder Jack’s Log Runner, I found that after adding the plugins to the port, the game too about 5 to 10 mins to load. I have seen this before when loading a lot of textures from resources but can be sure. The last thing I added before the problem was AdColony, which could have pushed me over the memory threshold. Time to pull it out and add some debug logs.

The first thing I did was to switch from my amazon branch to my google play branch to see if the problem was inherent or platform specific. For those who don’t know, most Android builds will work on Amazon devices because they are Android. You just have to watch out for the platform specific plugins.
Result: Same thing. So now, I am…