Scene freezing fixed & to my fellow nerds being bullied

So I finally figured out a huge performance bottleneck on the android platform that would freeze the entire game when the probes entered the screen.

I was writing what I thought was a really clever implementation to have prefabs or transforms loaded via code directly as opposed to be attached to a behavior script, which is attached to the scene. Well, it turns out that if you do this, then the resources are lazy loaded and when android has to load some resource, apparently it’s insanely slow. I created an Entity Container, kind of like dependency injection container so that on the scene I could have one place to look at where I knew all of the prefabs that were going into the scene. I haven’t consolidated all of them yet but I will so that I have a good picture of how many assets will be loaded for each scene. This idea is really inspired by Chris Pruett’s Google I/O presentation from a few years back where he mentioned on these mobile platforms you need to address the performance early on to prevent death from 1000 cuts.

I’ve also started implementing a brute force build process that would auto update the version, compile and deploy it to the web server. Interestingly enough, when you build from the Unity IDE, it hides a lot of details, such as how big the resources are and what’s going to make it in the final pack. Fortunately, Unity does perform a lot of optimizations, but this information is incredibly helpful as it will also allow me to make better decisions on what resources will go in. Anyways, next step is to install a continuous integration product on my windows server so that when any changes are committed, it builds and auto deploys.

Before, I end my post for today. I came across this video and was totally moved by it. So many reminders of a similar child hood with very few friends. I was that geek that was picked last for pretty much all sports, I did avoid certain hallways and I can’t even count the times that people messed with me.

However, I did make it out and I’m really happy now. They were wrong, indeed.

Leave a Reply