轉(zhuǎn)自:http://www.xuanyusong.com/archives/3685
比如編輯模式下對(duì)場(chǎng)景或者特定文件夾有一些操作可以在這個(gè)面板里來(lái)完成。凫碌。
代碼如下鸳址。
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(UnityEditor.DefaultAsset))]
publicclassCustomInspector:Editor{
publicoverride voidOnInspectorGUI()
{
stringpath=AssetDatabase.GetAssetPath(target);
GUI.enabled=true;
if(path.EndsWith(".unity"))
{
GUILayout.Button("我是場(chǎng)景");
}elseif(path.EndsWith("")){;
GUILayout.Button("我是文件夾");
}
}
}
如果你是unity5.3的話狱意, 想在場(chǎng)景面板上面繪制東西需要使用 UnityEditor.SceneAsset
[CustomEditor(typeof(UnityEditor.SceneAsset))]
本文固定鏈接: http://www.xuanyusong.com/archives/3685
轉(zhuǎn)載請(qǐng)注明: 雨松MOMO2015年10月23日 于 雨松MOMO程序研究院 發(fā)表