Post To Tumblr v4.19

Just a quick post today. I dont post every time I release a new version of my popular chrome extension Post To Tumblr (if I did there would be nothing but PTT posts on this blog), but I decided to make a video for this release as its been a while since I have made one.

In this release I added a much requested tags caching system and tag hints.


Unity Helper – Enumerate Resources

Unity Helper – Enumerate Resources

Following on from yesterdays post on my Unity-Helpers I have added another utility to the library.

Enumerate Resources

Enumerate Resources is a handy util for creating type-safe resource references. Traditionally you have to manually create constant strings to load resources at runtime:


This is fragile. If the asset is moved you wont know about the crash until you run the game, this line of code may not be executed often and hence introduces a bug that may only present itself at a later date.

Enumerate Resources scans a resources directory and generates a type-safe alternative:


Now if you move the resource and run the enumerator you will get a compile error.

For added sugar there is a method to add the loaded resource as a child of a game object (handy for prefabs):


You can grab the project, source and tests over at Github:

Unity Helpers – Utilities and Extensions for Unity

Unity Helpers – Utilities and Extensions for Unity

During the development of my up and coming game I have encountered some snags when developing in Unity so I wrote a number of utilities and extension methods to help out.

One such annoyance is the inability to use interfaces in GetComponent() and GetComponents(), so I wrote some extension methods to help with that:

using UnityHelpers;

var obj = new GameObject();

obj.Has<MyComponent>(); // Returns true or false
obj.Has<IMyComponent>(); // Can also handle interfaces

obj.Get<MyComponent>(); // Returns the first component
obj.Get<IMyComponent>(); // Returns the first component that implements the interface

obj.GetAll<MyComponent>(); // Gets all the components
obj.GetAll<IMyComponent>(); // Gets all the components that implement the interface

Another utility is for adding children to GameObjects:

using UnityHelpers;

var obj = new GameObject();

obj.AddChild("Mike"); // Creates a new GameObject named "Mike" and adds it as a child

var player = obj.AddChild<Player>("Dave"); // Creates a new GameObject named "Dave" and adds the component "Player" returning it

obj.AddChild(typeof(Player), typeof(Friendly), typeof(AI)); // Creates a new GameObject and adds a number of components

There are many other utils and extensions, and more to come.

Checkout the source for more info:

I have rigorously unit and battle tested these utils and added them to Github so I can use them in furthur projects. I hope they can be of some use to others too!