Skip to main content
  1. Posts/

Day 20 - Infrastructure 2

OldDays tools ste-reez-muvi Unity

Taking the plunge and updating some of my tools.

Unity 5

Time to make a sandwich, or even drive to Philly for a decent cheesesteak.
Time to make a sandwich, or even drive to Philly for a decent cheesesteak.

In truth, it was rather painless. It automatically made the few changes to one of my scripts that I was expecting:

  // disappear if desired
  GetComponent<Renderer>().enabled = toBeSeen;

public void UpdateMaterial(int currRound) {
  if (lastActiveRound >= currRound-1 && Health > 0f) // one round leeway in case we catch the DB in mid-update
    GetComponent<Renderer>().material = liveMaterial;
  else {
    presumedDead = true;
    GetComponent<Renderer>().material = deadMaterial;

…since the shortcut to the renderer has been removed, we have to get a reference to that component instead. Of course we don’t want to leave it this way, where it gets the reference every time; we’ll grab it in Awake. But glad the upgrade didn’t try to do that refactoring for me.

But the real candy for me is the Profiler that I now have access to. Here’s something I was expecting:

In all probability our database accesses.
In all probability our database accesses.

And something I wasn’t:

Especially given:

There must be some sort of default audio managing build into the Editor. When I Build & Run with the profiler hooked up to the now-external player:

The sweet sound of nothing.
The sweet sound of nothing.

Much better. And found the docs that explain it.

Now to verify the source of those CPU spikes. With the remotely attached Profiler, choosing one of those spikes to look at, I can see this far:


But then need to enable “Deep Profile” and run it in editor to drill down further:


Clearly we need to get those database calls out of that Update; out of the Unity UI thread completely, if possible. This may prove helpful.

Visual Studio Tools for Unity

Also pretty straightforward. It’ll take a little getting used to (VS has never been my home IDE), but seems like the way to go.

Octopress 3

I think I’ll publish this first.

More to come
More to come

Day 20 code - visualizer