Monthly archives: March, 2014

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…




Collective Mass Radio #5

As always, check out the rest of the blog as well as the other Collective Mass Radio podcasts on the site. You can follow Emil on Twitter at @angryant, check out his site at http://angryant.com/ or view his LinkedIn. Emil is currently available for interesting projects, so hit him up if you have something that requires his level of AI awesome!




Collective Mass Radio #4

As always, check out the rest of the blog as well as the other Collective Mass Radio podcasts on the site. You can follow Aras on Twitter at @aras_p. Send him your thoughts on just how cool the new Unity tech is!




Resizing Textures In Unity

It sounds silly but its true! Unity does not have any methods for resizing textures. Experienced readers might object, “what about Texture2D.Resize?” you say. Well, turns out that Texture2D.Resize only resizes the texture container, like trimming an array. Unlike trimming an array, Texture2D.Resize also sets the pixels to undefined. So really, all its doing is changing the amount of memory allocated. Thats all a bit disappointing, especially when you might be wanting to build a multi resolution pipeline for mobile. The weird thing is that Unity does this already when generating mip maps. So, lets roll up the old sleeves and figure this out.

We can get pixel data from texture, check! We can alter the pixel data, check! We can put pixel data into a texture, check! So whats left? The algorithm to resample pixel data. Resample is really the operative word because we are going to sample the source texture from the destination texture, pixel by pixel. This is exactly how pixel shaders work. So, We have our source texture at 1024×1024 and a destination texture at 512×512. What we are going to do is iterate through that 512×512 grid, find the corresponding color from the source texture and fill out destination pixel. Now we get to words you might have heard but never have known what they meant. Bilinear sampling is most common in games and gives a good understanding of how to sample but we are going to start with a technique called Nearest Neighbor. Resampling is mapping one set of coordinates onto another. So…




Collective Mass Radio #3

As always, check out the rest of the blog as well as the other Collective Mass Radio podcasts on the site. Take a look at Dela’s project, Rebel Future at http://rebelfuture.com/ or on his Facebook page, https://www.facebook.com/TheRebelFuture. View the trailer on Vimeo at http://vimeo.com/68990084.




Unity & MonoDevelop 4 Woes

Unity usually always brings it to the table with their updates but sometimes they miss a few things. The MonoDevelop 4 is shiny but has one serious problem with the basics, at least on OSX. This is code folding! At first, code folding looks great. I do like the ability to fold “if” statements, but after I update something, all hell breaks loose and I can’t fold anything anymore. My workflow relies on folding to help me navigate code (as I think it is so with a lot of other devs). So here are some steps to get back to the old version of Mono. I am on OSX Mavericks, on a mac book pro BTW. I am not sure if yall PC people have the same issue, but then you are probably using VS.

Dual Install Unity
Most people don’t know, but you can have multiple versions of unity on your machine. First, uninstall all your Unity instances. Next, do an install of Unity 4.2.2 (anything that is before 4.3). Once you have done this, rename your unity folder. I just rename it to “Unity 4.2.2”. Now install teh latest version of unity. So now, you have both versions of unity installed on your machine. The folders are “Unity” for the current and “Unity 4.2.2” for 4.2. Make sure update your shortcuts in your dock.
Link To The Old Mono
In the current install of Unity, open the Unity preferences and go to External Tools (Unity->Preferences->External Tools ). There, select “External Script Editor” and “Browse…” to open…




Collective Mass Radio #2




Collective Mass Radio #1