unity 修改编辑器

来源:互联网 发布:淘宝客服转化率怎么算 编辑:程序博客网 时间:2024/06/10 10:50

给Unity编辑器添加内容:  MenuItem

using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;public class HAHAHA : MonoBehaviour {[MenuItem("GameObject/MyCategory/Custom Game Object", false, 0)]static void CreateCustomGameObject(MenuCommand menuCommand){menuCommand.context = Selection.activeObject;GameObject go = new GameObject("Custom Game Object");GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);Undo.RegisterCreatedObjectUndo(go, "Create " + go);Selection.activeObject = go;}}


原创粉丝点击