Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

Big

I have released the v1.2 update to my CBX.GridMapping project.

Unity Asset Store: Asset store
Unty Forums: Fourm thread

Version Notes

Items starting with "Completed" are items that have been fully implemented as they were intended
Items starting with "Partial" are items that have only been partially implemented.

v1.2

  • Completed - CBXEditorHelpers.toolBarButtonSize need to be replaced with a setting in xml file
  • Completed - Need ability to specify in settings weather user need to hold alt ctrl or shift to draw and erase
  • Completed - For included prefabs you should have mesh generation ones as well as actual prefab *.fbx ones so the user does not wish to take advantage of mesh generation they can have option to use mesh based prefabs.
  • Completed - Should use multiple prefab list files so they can be bundled together and included with prefabs for distribution as a *.unitypackage
  • Completed - Recently used prefab list and recently used materials list should not show the name but rather just 'Select'
  • Completed - Recently used prefabs and material lists need a setting to say weather or not to show the object selection field or weather to just show a button.
  • Completed - Settings for setting the max number of items that a recently used lists can contain.
  • Completed - Need to localize all strings for grid mapping using a localization system
  • Completed - Have settings to specify the max height of the list of recent materials or prefabs
  • Completed - Categorized quick prefab selection
  • Completed - Additional prefab shapes for 2D and 3D
  • Partial - Ability to edit along different axis. Currently it only supports X/Z axis editing with layers extending into the Y plane. Partial support by granting the ability to rotate the map object and still draw
  • Completed - Have option to show recent material & prefab lists displayed as grid of buttons
  • Completed - GridMapping DrawMapInfo method uses a cloned skin from a label and makes it white for highlighting sections. You should not do this because it could cause issues if the skin is different.
  • Completed - Auto scale does not take into account rotation while drawing so a tall obj drawn with no rotation works fine but a tall object draw with 90 rotation along x causes it not to scale properly IE it does not fit within the cell dimensions. This has been fixed
  • Partial - When the map is rotated and user draws the prefabs are not rotated with the map and as such are not drawn in there proper location. This was partially fixed. Prefabs are placed where they should be but positioning the mouse over a grid cell on a map that is rotated is not exact and precice like it is when the map has no rotation. This gets exaderated when the active layer is beyond 3 layers deep. It works but it is not as acurate as I would like it to be.
  • Completed - Full setting customizability for changing grid & guideline colors etc
  • Completed - Tile material creation window needs setting in settings dialog for 'As list' check box as well as default output path etc
  • Completed - Tile material createion should have ability to flip along horiz and vert

v1.0 - v1.1

  • Initial release

Recently I needed to force the inspector to redraw itself from a piece of code outside of a Editor class. The solution I came up with was to call SetDirty on all selected objects of the type I was interested in. The inspector then picked up on the change and refreshed itself immediately. Although this code works under Unity 4 it is a hack and there may be a better way to force the inspector to redraw itself.

var objects = Selection.GetFiltered(typeof(GridMap), SelectionMode.TopLevel);
foreach (var o in objects)
{
    EditorUtility.SetDirty(o);
}

Did you know your editor scripts can acquire a preview texture for an asset? Check out the members of the AssetPreview class.


Big

My CBX.GridMapping tool for Unity has been accepted to the asset store! *Does the happy dance*  CBX.GridMapping is a in editor tool for unity that assists you in the creation of worlds that are based around a grid.

The current version of this tool does not contain a grid or tile mapping/management system. It is a in-editor creation tool only. A future update will include editor & runtime management API's.

*Temporary Homepage: http://www.createdbyx.com/page/CBXGridMapping.aspx
Google+ page: https://plus.google.com/100290581403134799105
Demonstration video: Getting started
Unity Forums Link: Unity Forums

Image tile sets are from Ari Feldman's SpriteLib (Common Public License) and are not included with this package.
http://www.widgetworx.com/widgetworx/portfolio/spritelib.html

The initial version that is on the asset store is a minimal v1.0 implementation. I am currently in the process of finalizing v1.2 features and documentation. v1.2 should be released some time in the first week of Jan 2013.

v1.2 features will include

  • Almost everything has a setting giving you the ability to customize how the tool looks and operates
  • Mouse wheel can be used to change layers
  • You can rotate the map object and draw v1.0 did not allow this.
  • Comes with mesh to code utility to convert simple meshes into C# code for procedural mesh generation
  • The quick prefab list is now categorized with a drop down menu
  • Many more prefab shapes both procedural and mesh based
  • 'Auto Center' drawing helper correctly takes into account a prefabs pivot point and positions a prefab centered to a grid cell
  • Will support multiple prefab definition files
  • Fully commented C# source code (xml documentation comments & inline code comments)
  • 95+% Of the code complies with the default StyleCop formatting settings.
  • All strings have been localized (English) with a custom built localization system

v1.0 and the up coming v1.2 are lacking certain features that are found in other popular tile mapping systems found on the asset store.

In time CBX.GridMapping will also include these list of features ...

  • A system to automatically change surrounding prefabs if certain conditions are met (Must take into account different prefab shapes)
  • A system to automatically change only the materials of surrounding prefabs if certain conditions are met
  • Formal API for developers to access and manipulate the map.
  • Ability to control where tools appear weather it be in scene view or in the inspector window
  • Integration with quick tools. A menu system I wrote that pops up a menu located around the mouse cursor.

I am also planning on making a few videos comparing UniTile, Tidy Tile Mapper, and CBX.GridMapping. The videos are intended to measure speed of the workflow for each tool and compare them when creating a specific map. This will help users decide for themselves if CBX.GridMapping is worth spending there monies on.

I have been keeping a list of about 60+ features that still need to be added to the CBX.GridMapping tool. Some are small some are large features so there is still a whole lot of work yet to do.


if you have MonoBehavior code that you want to run while in the unity editor you can use the ExecuteInEditMode attribute and your mono behavior will run as though it was in play mode.


The DrawGizmo attribute allows you to setup your gizmo drawing code some place other then with your MonoBehavior class. The code below shows an example of the DrawGizmo attribute used on a method within a Editor class.

    /// <summary>
    /// Provides a editor for the <see cref="TileMap"/> component
    /// </summary>
    [CustomEditor(typeof(TileMap))]
    public class TileMapEditor : Editor
    {
        /// The RenderMapGizmo method will be called if the map is selected. 
        [DrawGizmo(GizmoType.Selected | GizmoType.Active)]
        static void RenderMapGizmo(TileMap map, GizmoType gizmoType)
        {
            // store map width, height and position
            var mapWidth = map.Columns * map.CellWidth;
            var mapHeight = map.Rows * map.CellHeight;
            var position = map.transform.position;
            var activelayerHeight = map.ActiveLayer * map.Depth;

            if (map.drawGridLines)
            {
                // draw layer border
                Gizmos.color = Color.white;
                Gizmos.DrawLine(
                    position + new Vector3(0, activelayerHeight, 0), position + new Vector3(mapWidth, activelayerHeight, 0));
                Gizmos.DrawLine(
                    position + new Vector3(0, activelayerHeight, 0), position + new Vector3(0, activelayerHeight, mapHeight));
                Gizmos.DrawLine(
                    position + new Vector3(mapWidth, activelayerHeight, 0),
                    position + new Vector3(mapWidth, activelayerHeight, mapHeight));
                Gizmos.DrawLine(
                    position + new Vector3(0, activelayerHeight, mapHeight),
                    position + new Vector3(mapWidth, activelayerHeight, mapHeight));
 
                // more draw logic here
        }
    }

The alternative is that you can have a method in your MonoBehavior called OnDrawGizmosSelected

    /// <summary>
    /// Provides a component for tile mapping.
    /// </summary>
    public class TileMap : MonoBehaviour
    {
 
        /// <summary>
        /// When the game object is selected this will draw the gizmos
        /// </summary>
        /// <remarks>Only called when in the Unity editor.</remarks>
        private void OnDrawGizmosSelected()
        {
            // gizmo draw code goes here            
        }
    }

… But since gizmo drawing logic is typically for use within the unity editor the DrawGizmo attribute allows you to place the draw logic in a more appropriate location.


I have made a few minor changes to my Tile material Creation Window.

  • Provided a download link to the second release of the tool.
  • Added inset field to tweak the selection rectangle by a small amount to help clip off any unwanted pixels bleeding over from adjacent tiles.
  • Fixed a small bug where selection rectangles were not being drawn exactly where they should be

I have created a tool to assit in creating materials from tiles in a tile set. See the Tile Material Creation Window page for *.unitypackage download and more information.


If you have private fields that are wrapped with a public property but you want the value of those private fields to be saved with your scene you can use the SerializeField attribute.


Did you know with the release of Unity 4 MonoBehaviours can now be inside namespaces! Finally we can better organize our codez!


Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume