AssetPostprocessor.OnPreprocessModel Manual     Reference     Scripting  
Scripting > Editor Classes > AssetPostprocessor
AssetPostprocessor.OnPreprocessModel

function OnPreprocessModel () : void

Description

Add this function in a subclass to get a notification just before a model (.fbx, .mb file etc.) is being imported.

This lets you control the import settings trough code.

// Disable generation of materials if the file contains
// the @ sign marking it as an animation.

class DisableMaterialGeneration extends AssetPostprocessor {
function OnPreprocessModel () {
if (assetPath.Contains("@")) {
var modelImporter : ModelImporter = assetImporter;
modelImporter.generateMaterials = 0;
}
}
}