Unity Android compression – ETC2 vs. ETC1

I’ve been working on a Unity project for Android and iOS lately. For Android we had been using ETC2 for the texture compression. The ETC2 benefits were:

  • Better performance on devices where it’s supported.
  • Supports non power of 2 textures.
  • Works with all Unity UI canvas types.

The UI canvas support was particularly important to us as the project uses Unity UI extensively and almost entirely built with it.

Continue reading

Creating a grid of objects

Here’s some stripped down code I use to create a grid of objects in Unity. I’ve used this setup in my Android game Block Blaze when the level is initialised. It’s attached to a Generator object, which also has some other functionality like determining what type of object is created, whether an object needs to be regenerated if its destroyed, what object types are neighbouring, etc.,

Continue reading

Unity3D Development – Rigidbody Reset Force / Motion Code

In my new game I need to be able to give an object in motion a new force (same magnitude) in a random direction with a button press. Here’s my C# solution using Coroutines.
Its working perfectly for me and solves the weird physics problem with stopping/starting using rigidbody.isKinematic.

All these code snippets are in the script attached to the object:

Continue reading