网站首页 > 游戏开发 正文
比如编辑模式下对场景或者特定文件夹有一些操作可以在这个面板里来完成。。
代码如下。
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 | using UnityEngine ;
using System . Collections ;
using UnityEditor ;
[ CustomEditor ( typeof ( UnityEditor . DefaultAsset ) ) ]
public class CustomInspector : Editor {
public override void OnInspectorGUI ( )
{
string path = AssetDatabase . GetAssetPath ( target ) ;
GUI . enabled = true ;
if ( path . EndsWith ( ".unity" ) )
{
GUILayout . Button ( "我是场景" ) ;
} else if ( path . EndsWith ( "" ) ) { ;
GUILayout . Button ( "我是文件夹" ) ;
}
}
}
|
如果你是unity5.3的话, 想在场景面板上面绘制东西需要使用 UnityEditor.SceneAsset
1 2 3 | [ CustomEditor ( typeof ( UnityEditor . SceneAsset ) ) ]
|
猜你喜欢
- 2022-04-24 Unity3D研究院之通过ipa或apk获取游戏所使用的unity和Xcode版本
- 2022-04-24 Unity3D研究院编辑器之脚本生成Preset Libraries(十四)
- 2021-09-07 Unity3D研究院之系统内置系统图标大整理
- 2021-09-06 Unity3D研究院编辑器之5.3JSON的序列化
- 2021-09-06 Unity3D研究院编辑器之脚本打开SpritePacker窗口(十七)
- 2021-09-06 #你好Unity3D#Hierarchy视图监听gameObject点击事件
- 2021-09-04 Unity3D研究院之两个游戏工程资源同步问题(八十六)
- 2021-09-04 Unity3D研究院编辑器之不实例化Prefab获取删除更新组件(十五)
- 2021-08-30 Unity3D研究院编辑器之独立Inspector属性(九)
- 2021-08-30 Unity3D研究院之悬浮框显示其他游戏电流功耗(一百二十六)
本文暂时没有评论,来添加一个吧(●'◡'●)