PolyOrderFixupOnImport

Abstract
Author: Roger Braunstein (rogerimp)

'''Updated: This may be completely unnecessary in Unity 3.5+, please see the "Optimize Mesh" checkbox in import settings. See Manual'''

This editor script will prevent Unity from modifying the polygon ordering in a model upon import. Lore and evidence suggest that mesh optimizations are applied on import (even when the Mesh Compression import setting is Off).

In most cases this optimization is a good thing, as Unity seems to create triangle strips that would optimize rendering performance. In some cases, this is a bad thing, such as when you are attempting to render an overlapping discontinuous mesh in a single draw call from bottom-to-top (for instance, drawing a character on the same z-plane in a 2D game using the Unlit/Transparent shader). In this case, the optimizations could reorder your polygons and their carefully-created draw order.

The script does this by overriding the optimized mesh at import time, using the original polygon ordering. No additional work is required at run time.

Usage
To use this script, place it in the Assets/Editor directory. It will only run on models with an accompanying .csv file containing the original polygon ordering.

For instance, if your model is in Assets/Kimmy.fbx, it will look for an accompanying Assets/Kimmy.csv file.

Please ensure that you've triangulated your model before exporting it to FBX. Quads are not supported.

The script is intended for FBX files that have a single mesh in them. It could be extended to support bigger scenes if you need.

Creating the CSV file
In Cinema 4D, select your Polygon Object (model) in Model mode. Make sure you haven't hidden any polygons (use Selection>Unhide All). Find the Structure Manager or open it up with Window>Structure Manager. Go into polygon mode with Mode>Polygons. File>Export and pick the location next to the exported FBX. C4D will name it .txt, so rename this to .csv. (This extension is easily customizable, maybe we should call it .polygonlist or something more descriptive?)

Feel free to edit this article to include instructions for other 3d packages.

Contributions Accepted
If your 3d package can export polygon ordering to some kind of text file, it should be pretty easy to accept a new format in this script. Please change it and let me know (PM me on the forums).

I can provide a python script that reads this information from any FBX, but you'll need to have python and the Autodesk FBX SDK for Python installed. (In theory, we could read this info directly from the FBX in this script, but I'm keeping it simple.)