So I received some feedback on the HoloLens. Watch the video to get all the juicy details. If you don’t have time to watch, that’s cool. It boils down to a little rant around the field of view bit I keep getting asked about followed by me talking about how Andy, from the HoloLens team, emailed me to ask for the source code of the little music visualizer app I created and deployed to the HoloLens.
It seems my video showing how to deploy an Unity app to the HoloLens was passed around the team with the title of
“Any guesses about why this deployed app is the worst thing ever?”
When I first saw that, I was taken back a little but that feeling quickly faded when I read the next sentence:
“Basically, that app should run great and we want to know why it isn’t.
There is a huge amount of speculation going on in the thread, and basically we just want to see the source. Can you bundle it up and mail it to me?”
Of course, I bundled up the app to the whopping 600KB it weighed in as (minus the mp3s) and sent it to Andy. I felt bad that engineers at Microsoft was taking time to look at my little demo app that I threw together sometime last year. I was happy to see them reaching out to developers though to make sure that they are able to get their apps to run on the platform.
Shortly after sending the code I received a couple of tips. The first tip was that I should change any places I used “FixedUpdate” to simply “Update”. I updated the code to take that into account. So far, that is the only update I made to the code and you can see a dramatic difference as the blocks are actually in sync with the music now.
I’m not sure why I was using FixedUpdate in the first place but it totally makes sense why that would be a problem. FixedUpdate can be beneficial when you want to make sure this code gets called a specific number of times a second – or every X milliseconds. This can be beneficial for handling physics.
However, most of the time you want your code to call Update, which gets called every frame. Receiving input, moving non-physics objects (like my visualizer cubes), AI and many other bits can all be updated this way inside of the Update method.
Update isn’t called on a regular time interval. If one call takes longer than another then the time between update calls be different. FixedUpdate, on the other hand, is called at a fixed time. The time between update calls are consistent. So if the fixed timestep is 0.02 it means that Unity is going to try real hard to make sure each FixedUpdate call happens 50 times per second regardless what the render frame rate is. If the game or app is running slower and the frame rate drops to say 25 fps, then it will try to run FixedUpdate twice to catch up – which will just drive the frame rate lower. At some point this cycle of badness just bottoms out. This was why my little app was not running correctly on the HoloLens.
I expect I’ll have more performance tips that comes from my adventures with the HoloLens. To stay informed you could subscribe to my YouTube channel. I have other ways to stay connected in the near future.
As always, feedback is welcome. 🙂 Leave me comment and let me know what you would like to see next with the HoloLens.