Tuesday, July 14, 2015

Blender editor script for Unity

We've been doing a lot of Unity development recently, and one of the things we find really awkward about it is its Blender support.  Unity's preferred axis doesn't match Blender's, in particular.  We've been using an editor script to help this, which I figured I'd post below.  It does the following things:

- Defaults to not importing materials.  It seems to cause a mess more than anything so we create these by hand.  This is easy to disable if you don't like that.
- Swaps the Y and Z axes so that up in Blender is also up in Unity, and fixes the right/left thing with the X axis.
- Adjusts coordinates so that the Blender object's origin ends up 0,0,0 in the imported mesh.
- Lets you ignore a mesh by putting _ at the start of its name.  For example, an object in the Blender file named "_reference" would not be imported.

We've been using this for static models and it's generally behaved well.  To use, copy/paste the below into a file called BlenderTweaks.cs, and put it in your Assets/Script/Editor folder.

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class BlenderTweaks : AssetPostprocessor
public override int GetPostprocessOrder()
return base.GetPostprocessOrder() + 10;

void OnPreprocessModel()
// Don't import materials.
ModelImporter modelImporter = assetImporter as ModelImporter;
modelImporter.importMaterials = false;

private void OnPostprocessModel( GameObject gameObj )
// Debug.Log( "OnPostprocessModel: " + gameObj.transform.name );

MeshFilter[] meshFilters = gameObj.GetComponentsInChildren();

for( int i=0; i
Mesh mesh = meshFilters[i].sharedMesh;

if( mesh.name[0] == '_' )
Debug.Log( "Ignoring mesh: " + mesh.name );

Component.DestroyImmediate( meshFilters[i].gameObject );
Component.DestroyImmediate( meshFilters[i] );
Component.DestroyImmediate( mesh );
RotateMesh( mesh );

meshFilters[i].transform.localPosition = Vector3.zero;


private void RotateMesh( Mesh mesh )
//switch all vertex z values with y values
Vector3[] vertices = mesh.vertices;

for( int i=0; i < vertices.Length; i++)
vertices[i].Set( -vertices[i].x, vertices[i].z, vertices[i].y );
mesh.vertices = vertices;

//recalculate other relevant mesh data

Friday, July 10, 2015

Ten new TransPlan levels!

We've just pushed an update to Steam that adds a new node ("Master II") along with ten more levels! This will be following shortly to Android and iOS, and includes a new achievement as well.

Friday, June 26, 2015

Unium & Transplan now available on Kindle!

... or at least all the "fire" variants anyway.  These are straight up purchases, no trickery with ads or anything, and we're hoping all the Kindle users enjoy!  Links are below!

Unium on Amazon Kindle
TransPlan on Amazon Kindle

TransPlan v1.0.1

- Bug Fix: Fixed occasional issue with undoing pins
- Bug Fix: Fixed save problem with Master achievement

This update clears away the last of the minor bugs we're aware of, in particular the Master Planner achievement no longer requires that all the master levels be completed at par.  This was mostly an issue since the description made no mention of that.

A bug was also fixed that caused pins to be relocated incorrectly when using undo on a mobile platform.  Sorry about it!

Thursday, June 18, 2015

TransPlan now available on Android!

Get it for free here!

Now complete with full support for both portrait and landscape!  This incorporates all the little fixes that have happened to the Steam version since release, and incorporates both Google Play Games achievements and cloud saves as well.

We're taking a bit of a different tack with the mobile versions of the game.  As outright selling titles doesn't seem to work too well on mobile these days, TransPlan is free on both Android and (soon) iOS.  Occasional interstitial ads will appear between levels, and you can use an in-app purchase to disable these entirely if you wish.

Hopefully folks enjoy!