1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
[MenuItem("Assets/美术辅助工具/指定目录,刷新包含PlayableDirector组件的SceneBindings属性")] private static void Refresh() { int count = 0; string[] selectGUID = Selection.assetGUIDs; //得到当前选中的资源GUID数组 for (int i = 0; i < selectGUID.Length; i++) { string path = AssetDatabase.GUIDToAssetPath(selectGUID[i]); //转化GUID为string路径 string[] absolutePaths = Directory.GetFiles(path, "*.prefab", SearchOption.AllDirectories); foreach (string allPath in absolutePaths) { GameObject o = AssetDatabase.LoadAssetAtPath<GameObject>(allPath); PlayableDirector[] playable = o.GetComponentsInChildren<PlayableDirector>(); for (int j = 0; j < playable.Length; j++) { PlayableDirectorInspector.Refresh(playable[j]); count++; } if (playable.Length > 0) EditorUtility.SetDirty(o); } } AssetDatabase.SaveAssets(); Debug.Log("刷新完成,数量:" + count); } |
- 本文固定链接: http://www.u3d8.com/?p=2810
- 转载请注明: 网虫虫 在 u3d8.com 发表过