I recently received a question asking if Rotorz Tile System could be used to paint 2D tiles. A tile is a three-dimensional object that is represented by a prefab. So the answer was yes, because a plane can be created and mapped to the tile texture. When working with tile sets it is generally a good idea to pack tiles into a texture atlas in order to keep the number of draw calls low.
The process of creating such tiles manually is not an overly complicated procedure, but can easily become time consuming. A plane mesh must be created for each texture atlas mapping with varying UVs for each tile. A tile brush must then be created for painting with. So I decided that it would be useful to add a utility window to ease the process of creating 2D tile brushes.
The following video demonstrates the process of creating a 2D tile set. The video then proceeds to demonstrate the creation of an oriented tile brush using the automatically generated tile brushes.
Credit for demo atlas artwork: http://mapledev.tumblr.com/post/10406905135/howtotileset
Many of the editor extensions that are available from the asset store are closed source. For those who do not understand, this simply means that the source code is compiled into one or more class libraries (DLL).
There are a number of very good reasons why some extension developers choose to do this:
- Avoid script naming conflicts with user code and indeed other extensions
Unity requires that each script file that contains a MonoBehaviour is named to match the class name. Unity does not allow two user scripts to coexist with the same name; neither directories or namespaces will help here!
However, these limitations do not apply to behaviours that are exposed by a class library. When developing a class library it is also possible to put namespaces to good use! This helps to avoid clashing with other extensions!
In order to detect that a player has fallen to certain death there needs to be some sort of detector. The detector needs to be positioned and scaled to fill the gap at the point of no return. Box colliders tend to work best for this because they can be positioned and scaled easily.
In my game I wanted the player to respawn from the side that they fell from to avoid skipping a tricky area! To achieve this I added one sensor for each major ledge. Upon being hit, the sensor selects itself as the active respawn position for that fall.
The way in which falls are detected and handled will vary with design. I found that there are usually two such sensors for each fall, one before and one after. Or perhaps just one for the start and/or end of a level! Of course there may be occasions where additional sensors are needed; like with high climbs.
When creating Munchy Bunny! I was using an extension called Tidy Tile Mapper which allows you to create levels using 3D tiles. This is a fantastic extension for Unity which offers a lot of powerful features. Unfortunately I encountered several major limitations which made it difficult to achieve what I needed:
- Each level consists of two separate grids; a large one for platforms and a smaller one for chocolate bricks, eggs, diamonds, etc. The grids have to occupy the same space on the Z-axis. This meant that the grids had to be separated to work on them and then moved back again afterwards. This was an extremely slow and tedious process which caused the Unity editor to crash on multiple occasions.
- I found that the Unity editor began to run extremely slowly when using grids (even when empty) of 300 columns by 100 rows (the small grid size for Munchy Bunny!)
- It was not possible to define custom block orientations which meant that I was unable to create blocks to the quality that I desired.
A couple of days ago I decided to publish a demo version of Munchy Bunny! There were several motivations behind this:
- A useful opportunity to learn how the Chrome WebStore works.
- Promote interest in Munchy Bunny!
- Allow developers that have shown an interest in the game from the Unity community to take it for a spin!
- Provide a demonstration of the tile system that Rotorz Limited hope to release soon.
The overall process was relatively straightforward and I wanted to share my experiences in this post. Some of this will apply to all Chrome WebStore extensions, however some will apply more to those who are developing games using the Unity 3D game engine.