[MenuItem("Tools/BatchPrefab All Children")]
public static void BatchPrefab(){
Transform tParent = ((GameObject)Selection.activeObject).transform;
Object tempPrefab;
int i = 0;
foreach(Transform child in tParent){
tempPrefab = EditorUtility.CreateEmptyPrefab("Assets/Prefab/" + child .name +".prefab");
tempPrefab = EditorUtility.ReplacePrefab(child .gameObject, tempPrefab);
i ++;
}
}
原文
http://blog.youkuaiyun.com/daijinghui512/article/details/20452665