新手上路(根据美术的需要写了工具 解决重复拖放浪费时间)
2016-12-20
using UnityEngine; using System.Collections; using UnityEditor; public class ToolsCreatPrefab { [MenuItem("Tools/Creat All Children Prefab")] public static void BatchPrefab() { //选中的物体 Transform tParent = ((GameObject)Selection.activeObject).transform; Object tempPrefab; int i = 0; foreach (Transform item in tParent) { //现在指定的位置创建一个空的预制物 然后查找你点击物体下的所有子物体 名字还是用子物体的名字 tempPrefab = PrefabUtility.CreateEmptyPrefab("Assets/Resources/Prefabs/Model/" + item.name + ".prefab"); tempPrefab = PrefabUtility.ReplacePrefab(item.gameObject, tempPrefab); i++; } } }
时间: 2024-10-14 11:16:27