unity 编辑(Editor)模式制作prefab

Object go2 = AssetDatabase.LoadAssetAtPath(MakeCreaturePrefabWindow.Check_modelNames[key].Replace(@"\", "/") + "/" + key + ".fbx", typeof(Object));

if (null != go2)

{

GameObject GG = go2 as GameObject;

if (GG)

{

Animation _animation = GG.GetComponent();

if (_animation)

{

for (int i = 0; i < _clipList.Count; i++)

{

_animation.AddClip(_clipList[i], _clipList[i].name);

}

GG.transform.localPosition = Vector3.zero;

Object _prefab = PrefabUtility.CreateEmptyPrefab(ProjectDirectory.PrefabLocalPath_Creature + "/" + key + ".prefab");

PrefabUtility.ReplacePrefab(GG, _prefab);

}

else

{

DebugX.Log("animation is null.");

}

}

else

{

DebugX.Log("NULL");

}

}

else

{

DebugX.Log(MakeCreaturePrefabWindow.Check_modelNames + " is null.");

}

你可能感兴趣的:(unity 编辑(Editor)模式制作prefab)