常常寫EditorWindow但又常常忘了怎寫
把寫好的放上來,以後要改比較方便
順便提供一些小工具
當專案比較大時,資料夾結構很深,有時常需要知道asset的path。所以寫了一個小工具可以看Asset的path
using UnityEngine; using System.Collections; using UnityEditor; public class GetSelectedAssetPath : EditorWindow { [MenuItem ("Window/GetSelectedAssetPath")] static void Init () { // Get existing open window or if none, make a new one: GetSelectedAssetPath window = (GetSelectedAssetPath)EditorWindow.GetWindow (typeof (GetSelectedAssetPath)); } void OnGUI () { if (GUILayout.Button("Select", GUILayout.Width(60))) { Debug.Log(AssetDatabase.GetAssetPath(Selection.activeObject)); } } }
沒有留言 :
張貼留言