http://www.cnblogs.com/zhaoqingqing/p/3812368.html

1、Apply to Prefab [把改动应用到Prefab]

if (GUILayout.Button("Apply Collider To Prefab"))
{
PrefabUtility.ReplacePrefab(simActor.Preview, PrefabUtility.GetPrefabParent(simActor.Preview), ReplacePrefabOptions.ConnectToPrefab);
}
 
 
2、Current SceneView Center Position :获取Scene中间坐标
比如每次 New Actor时,都出现在Scene视图的中间

   SceneView.onSceneGUIDelegate -= OnCustomSceneGUI;
void OnCustomSceneGUI(SceneView sceneview)
{
SceneViewPos = sceneview.pivot;
}
//创建Actor
public void CreateMapActor()
   {
GameObject gameLogic = GameObject.Find("MapLogic");
GameObject newActor = GameObject.CreatePrimitive(PrimitiveType.Sphere); newActor.name = "Actor-" + UnityEngine.Random.Range(1, 999999);
CBaseTool.SetChild(newActor.transform, gameLogic.transform);
Selection.activeGameObject = newActor;
CSimActor simActor = newActor.AddComponent<CSimActor>(); newActor.transform.position = SceneViewPos;
}
3、Scene Context Menu[场景视图右键菜单]

可以参考NGUI的 UIWidgetContainerEditor. NGUIEditorTools.ShowSpriteSelectionMenu(e.mousePosition); 我这儿实现的,还没有做处理

using UnityEngine;
using UnityEditor; [InitializeOnLoad]
[ExecuteInEditMode]
public class MySceneContext : MonoBehaviour
{ void Update()
{
SceneView.onSceneGUIDelegate = SceneContext;
} void SceneContext(SceneView sceneview)
{
if (Selection.activeTransform == null) return;
Transform selectTrans = Selection.activeTransform;
Vector3 curPos = selectTrans.position; Event evt = Event.current;
if (evt.type == EventType.ContextClick)
{
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("MenuItem1"), false, CallBack, "item 1");
menu.AddItem(new GUIContent("MenuItem2"), false, CallBack, "item 2");
menu.ShowAsContext();
evt.Use();
}
} void CallBack(object userData)
{ }
}
4、Inspector Context Menu

[MenuItem("CONTEXT/Transform/MyContext1")]
public static void MyContext(MenuCommand command)
{
CBase.Log("context menu");
}

参见:http://docs.unity3d.com/ScriptReference/MenuCommand-context.html

http://answers.unity3d.com/questions/22947/adding-to-the-context-menu-of-the-hierarchy-tab.html

The CONTEXT/{string} seems to work for components within the Inspector

同时可查看 NGUI\Editor\NGUIContextMenu.cs

Asset Store工具推荐:https://www.assetstore.unity3d.com/en/#!/content/10424

Unity Editor Toolbar 编辑器扩展的更多相关文章

  1. Unity Editor Console Pro 扩展点击定位到外部工程

    链接 http://blog.csdn.net/akof1314/article/details/53232981 http://forum.china.unity3d.com/thread-2689 ...

  2. unity打包选项编辑器扩展

    using UnityEngine; using UnityEditor; using UnityEditor.Callbacks; using System.IO; public class Pos ...

  3. Unity编辑器扩展Texture显示选择框

    学习NGUI插件的时候,突然间有一个问题为什么它这些属性可以通过弹出窗口来选中呢? 而我自己写的组件只能使用手动拖放的方式=.=. Unity开发了组件Inspector视图扩展API,如果我们要写插 ...

  4. Unity 3D编辑器扩展介绍、教程(二) —— 创建窗口

    Unity编辑器扩展教程(二) 本文提供全流程,中文翻译.Chinar坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) 一 Brief Introd ...

  5. Unity 3D编辑器扩展介绍、教程(一) —— 创建菜单项

    Unity编辑器扩展教程 本文提供全流程,中文翻译.Chinar坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) 一 Brief Introduct ...

  6. Unity编辑器扩展 Chapter7--使用ScriptableObject持久化存储数据

    Unity编辑器扩展 Chapter7--使用ScriptableObject持久化存储数据 unity unity Editor ScirptableObject  Unity编辑器扩展 Chapt ...

  7. Unity编辑器扩展chapter1

    Unity编辑器扩展chapter1 unity通过提供EditorScript API 的方式为我们提供了方便强大的编辑器扩展途径.学好这一部分可以使我们学会编写一些工具来提高效率,甚至可以自制一些 ...

  8. Unity 编辑器扩展

    自定义检视面板的使用: 先是定义一个脚本文件,我们来修饰它的检视面板: [HelpURL("http://www.baidu.com")] public class Atr : M ...

  9. unity 编辑器扩展简单入门

    unity 编辑器扩展简单入门 通过使用编辑器扩展,我们可以对一些机械的操作实现自动化,而不用使用额外的环境,将工具与开发环境融为一体:并且,编辑器扩展也提供GUI库,来实现可视化操作:编辑器扩展甚至 ...

随机推荐

  1. SPOJ1811 && SPOJ1812

    SPOJ1811 && SPOJ1812 LCS && LCS2 非常神奇的两道题... 题目大意: 给定n个字符串,求最长公共子串 做法1: 后缀数组: 把字符串连起 ...

  2. [BZOJ4556][TJOI2016&&HEOI2016]字符串(二分答案+后缀数组+RMQ+主席树)

    4556: [Tjoi2016&Heoi2016]字符串 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1360  Solved: 545[S ...

  3. POJ 3904 JZYZOJ 1202 Sky Code 莫比乌斯反演 组合数

    http://poj.org/problem?id=3904   题意:给一些数,求在这些数中找出四个数互质的方案数.   莫比乌斯反演的式子有两种形式http://blog.csdn.net/out ...

  4. asp.net mvc4 简单使用Autofac依赖注入小结

    1,首先使用 NuGet下载适当的Autofac版本 文件一,Autofac.3.5.2 文件二,Autofac.Mvc4.3.1.0 1,接口类 public interface IReposito ...

  5. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟

    D. Little Artem and Dance 题目连接: http://www.codeforces.com/contest/669/problem/D Description Little A ...

  6. Codeforces Beta Round #5 D. Follow Traffic Rules 物理

    D. Follow Traffic Rules 题目连接: http://www.codeforces.com/contest/5/problem/D Description Everybody kn ...

  7. 2015 百度之星 1004 KPI STL的妙用

    KPI Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acdream.info/problem?pid=1754 Description 你 ...

  8. CentOS 6.9/7通过yum安装指定版本的PostgreSQL扩展PostGIS

    一.安装PostGIS扩展插件(24_10) // 安装EPEL源 # rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-rele ...

  9. Circuit provides reference for multiple ADCs

    The achievable accuracy for systems with multiple ADCs depends directly on the reference voltages ap ...

  10. linux之inode

    一.inode是什么? 理解inode,要从文件储存说起. 文件储存在硬盘上,硬盘的最小存储单位叫做”扇区”(Sector).每个扇区储存512字节(相当于0.5KB). 操作系统读取硬盘的时候,不会 ...