Improved Animations and Tile Objects in Tiled2Unity

by Seanba on December 26, 2015

Hi there and Happy Holidays. I got some glorious free time this Christmas break to finalize a couple of improvements I’ve been working on for Tiled2Unity.

As always, you can find the latest version of Tiled2Unity here.

Tile Animation Performance

I’ve long been embarrassed at how I had originally supported tile animations from Tiled Map Editor. It was a hack that manipulated vertex data at runtime which was a) slow and b) caused garbage collection spikes as vertex and index buffers were be allocated on the fly. Tiled2Unity now controls animation through enabling and disabling MeshRenderer instances. It’s cheap and simple.

I’ve added a new scene to the Mega Dad example suite that shows off tile animations while revisiting our old NES friend, Mega Man 2.

Here I've recreated Flashman's lair from Mega Man 2. The tile animations were made in Tiled and are exported to Unity without any additional work needed. It's meant to be quick and easy.

Here I’ve recreated Flashman’s lair from Mega Man 2. The tile animations were made in Tiled and are exported to Unity without any additional work needed. It’s meant to be quick and easy.

Note: You can find this example (and others) on GitHub to see how I use Tiled2Unity. All examples have been upgraded to the latest version of Tile2Unity.

Tile Objects Now Supported

Sometimes you want a single tile placed in your map without the hassle of having it as part of a Tile Layer. These Tile Objects were being exported as a simple transform (no visual tile) with earlier versions of Tiled2Unity. Now they are fully supported.

Tiled Object Layer

Object Layers are a good way to add extra, level-specific images and tags to your map without managing a whole Tile Layer.

Tile Object

Objects are generally exported as colliders by Tiled2Unity but the Tile Object is a special type that lets you place a single tile anywhere in your map. Colliders on that Tile Object are also exported.

Some Caveats

This was a significant change to Tiled2Unity compared to earlier updates. Here are some things to be aware of:

  • Unity 4.x support has been removed. Sorry, but supporting older versions of Unity has become unwieldy. For what it’s worth, Sony and Microsoft (and I suspect Nintendo too) are phasing out support for Unity 4.x as well.
  • Prefab GameObject heirarchy has been changed. In order to better support animations and object rotation and scaling I have changed how Tiled2Unity prefabs are constructed. You may have some scripts that were taking for granted a particular parent-child relationship that will need to be updated. (I recommend using tags to avoid issues like this in the future, not just when using Tiled2Unity, but as a general rule.)
Reminder: Tiled Map Editor has been totally free for years now. Please consider contributing to Thorbjorn Lindeijer’s Patreon for continued Tiled Map Editor support.

{ 2 comments… read them below or add one }

Tim December 27, 2015 at 4:44 pm

Thanks for continuously updating this awesome tool! I really appreciate the work you put into making this the best tile map solution for Unity.

Oliver December 28, 2015 at 8:06 am

Fantastic update! Thank you for making the best tilemap solution for Unity even better!

Leave a Comment

Previous post:

Next post: