AssetDatabase.ImportAsset( ..)

I tried making a menu item to import a model as follow. But it does not import at all. Please help .

using UnityEngine;
using UnityEditor;
using System.Collections;

public class MyMenuItems : ScriptableObject {

	[MenuItem("Assets/Import Model")]
	static void ImportModel()
	{
		DoWork();
	}
	
	static void DoWork()
	{
// import maya model
		string path = @"c:\temp\house.mb";
		ModelImporter modelImporter = AssetImporter.GetAtPath(path) as ModelImporter;
		AssetDatabase.ImportAsset(path, ImportAssetOptions.Default);
	}
}

Is it true that if I copy a model into the Assets folder, it will automatically be imported ?
Is it also automatic in batch mode ?

Yes, it will be automatically imported only and only if the engine supports/recognizes your imported mesh :slight_smile: