Tag: Profiling

Unity Debug Diaries

Unity Debug Diaries: Mip Map Memory Reduction

First off, I must apologize for the weird tense swapping that happens in these articles. I write stuff as it happens and do not want to do too much editing lest these become too tedious to write and then I just stop completely. So if you can deal, I will continue to write 🙂

Today, I am attacking using Mip Maps on UI for multi-resolution rendering. Enabling Mip Maps and managing which of the maps are loaded into memory is the easiest way to handle texture memory on lower end devices. Now, I believed this but did not see the reduction in the profiler on device. So then I figured it was a fallacy because the data suggested otherwise. I then switched to TK2D to handle a lot of my multi sized sprites but the lack of clarity on the issue always bugged me. So now, I want to find out for sure. I cant get a straight answer out of anyone so its time to set up some tests.

First, I am going to make a separate project in iOS to have a clean environment and have nothing muddy my results. I am choosing iOS because its got its own set of profiling tools that will help me isolate if the Unity Profiler is telling porky pies (lies).
Results: Lies lies lies! So profiling in iOS showed a radical drop in memory based on the appropriate quality settings. I have four 2048×2048 at 32 bit. The results in the profiler are:

Full resolution: 107.66mb
Half resolution: 43.68mb
Quater resolution: 27.69mb

These results…

Connecting the Unity Profiler to your iOS Device

While doing some contract work recently I found that the Unity Profiler no longer reports accurate texture memory figures for mobile while you are in editor. Maybe it never did but I swear it did an some point. Rest assured, all the texture compression settings are still fine, you just have to test on device now. I had never done this with the latest release of Unity and remembered the days where I wished I could. So I gave it a bash and it is dope! Here are the steps you follow:

Make sure your mobile device is on the wifi network. The profiler uses a network connection to send data back to Unity.
Make sure you have “Development Build” and “Auto Connect Profiler” check to on in the build settings (handy shortcut for the build menu, Command + Shift + B)

Build for XCode. Make sure you are using a profile that allows you to be running the XCode debugger, so not an enterprise profile.
When the game launches, grab the IP address that appears in the XCode debug console. It will have a port number so make sure to get that as well.

In Unity, in the profiler, click on the “Active Profiler” button in the bar at the top. Sometimes it picks it up automatically, but if not, dump in…