AssetPostprocessor.OnPostprocessModel

function OnPostprocessModel (root : GameObject) : void

Description

Add this function in a subclass to get a notification when a model has completed importing

just before a prefab is generated out of the game object hierarchy root is the root game object of the imported model.

// Adds a mesh collider to each game object that contains collider in its name        

class ColliderOnName extends AssetPostprocessor {
function OnPostprocessModel (g : GameObject) {
Apply(g.transform);
}

function Apply (transform : Transform) {
if (transform.name.ToLower().Contains("collider"))
transform.gameObject.AddComponent(MeshCollider);
// Recurse
for (var child in transform)
Apply(child);
}
}