What is the Platformer Editor Tool?
The Platformer Editor Tool is a tool for quickly creating and editing platformer levels. It’s based on drawing pixel maps of your level and then mapping each colour to a GameObject. The tool will detect each colour in your texture and shows this in a list, from where you can select prefabs. After clicking on “Generate Level” the prefabs will be placed on the exact same spot as their matching colours. The tool is mainly for 2D editing.

The tool is made for Unity.

How it works
For editing levels, I created an editor window. In this window you can create a “Level Data” list. This is a ScriptableObject, which contains: the name of your level, the texture of your level, the ColourMappings and it can also store a prefab of your generated tiles.

Once you created a new list, or opened an already existing one, you can edit the name and the texture of your curren level. Once you select a texture, you can create your ColourMappings. The ColourMappings consist of a colour and a GameObject. These colours are detected with nested for-oops (x and y). In this for loop, the tool iterates over every pixel in the texture and saves eery unique colour to a list. For every colour in the list, a ColourMapping is created with this colour. If you need to, you can remove ColourMappings by clicking on “Delete Last Mapping”. Only the last ColourMapping will be removed.

After mapping the colours to prefabs, you can generate your level. The tool will instantiate each prefab in editor mode in your scene. It will place these gameobjects as children of (levelName + ” Generated Tiles”) in the Hierarchy.

You can choose to export your level, which will create a prefab from the Generated Tiles object and places it in your LevelData ScriptableObject.

Started: November 2017
Finished: January 2018


Source Code