AssetPostprocessor.OnPostprocessModelfunction OnPostprocessModel (root : GameObject) : voidDescriptionAdd 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. class MyModelPostprocessor extends AssetPostprocessor {
function OnPostprocessModel (g : GameObject) { Apply(g.transform); } // Add a mesh collider to each game object that contains collider in its name function Apply (transform : Transform) { if (transform.name.ToLower().Contains("collider")) { transform.gameObject.AddComponent(MeshCollider); } // Recurse for (var child in transform) Apply(child); } } |
