how to do a batch mode "dragging" an asset to hier

Hi , I need some help in scripting automation of making an asset into hirerachy .

I searched everywhere in the scripting manual … :frowning:

Can you give a bit more detail about what you want to do?

I am trying a way to (automatic in commandline mode) create a project , import assets , and then create gameojbects based on the main asset .

I have the commandline to create a project already. Also I found that if I copy the 3d model file into \Assets\ folder , it will be automatically import when the project is opened the next time (which I can do in commandline mode too).

But how do I create game object under the “Hierarchy” Editor window ? If I do it by hand, I will “drag” the model from asset to Hierarchy window. The GUI Editor will do some complicated (unknown) processes to create the game object.

How to script the drag-from-asset-to-hierarchy action ?

I just want to have the same end result, which is a game object instant of the model in assets.

Thanks for your interest.

You can create scene objects by using Object.Instantiate with a prefab from the Assets folder.

Thanks.
If I know the path of the asset, can I call
AssetDatabase.LoadAssetAtPath (which will return an UnityEngine.Object reference) ? And then call UnityEngine.Object.Instantiate as follow :

UnityEngine.Object objref = AssetDatabase.LoadAssetAtPath(“Assets/myModel.mb”, Transform);

UnitEngine.Object.Instantiate( objref, Vector3.zero, Quaternion.identity);

//I tried it and added some statements (and it works) :

string[ ] scenes = { “myScene.unity” };
EditorApplication.NewScene();

UnityEngine.Object objref = AssetDatabase.LoadAssetAtPath(“Assets/myModel.mb”, Transform);

UnitEngine.Object.Instantiate( objref, Vector3.zero, Quaternion.identity);

EditorApplication.SaveScene(scenes[0]);
AssetDatabase.SaveAssets();
/*
Now how do I build a web player via script ?
What extension should I should for the locationPathName:

static function BuildPlayer (levels : string[ ], locationPathName : string, target : BuildTarget, options : BuildOptions) : string
*/