在Editor下创建脚本写下:(我的所有预制体都放在 Assets/Prefabs(包含文件夹)里了)
1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEditor; 4 using UnityEngine; 5 using System.Threading; 6 using System; 7 using System.IO; 8 9 public class Shortcuts : EditorWindow 10 { 11 static Shortcuts window; 12 13 public string fullPath = "Assets/Prefabs/"; 14 MonoScript scriptObj = null; 15 int loopCount = 0; 16 List<Transform> results = new List<Transform>(); 17 18 [MenuItem("Shortcuts/Test")] 19 static void Execute() 20 {