using UnityEngine;
using System.Collections;
using UnityEditor;
[AddComponentMenu("ff/gg")]
public class Main : MonoBehaviour
{
private new Camera camera;
//自定义菜单栏 1
[MenuItem("ObjectManger/Clone")]//克隆一个物体的菜单选项
static void ClothObject()
{
Instantiate(Selection.activeTransform, Vector3.zero, Quaternion.identity);
}
[MenuItem("ObjectManger/Clone", true)]//设置菜单的激活(当选择物体不为空时设置可用状态
static bool NOClothObject()
{
return Selection.activeObject != null;
}
//自定义菜单栏 2
[MenuItem("ObjectManger/DeleteObject")]//删除一个物体的菜单选项
static void RemoveObject()
{
DestroyImmediate(Selection.activeGameObject, true);
}
[MenuItem("ObjectManger/DeleteObject", true)]//删除一个物体的菜单选项(当选择物体不为空时设置可用状态
static bool NoRemoveObject()
{
return Selection.activeGameObject != null;
}
}
using System.Collections;
using UnityEditor;
[AddComponentMenu("ff/gg")]
public class Main : MonoBehaviour
{
private new Camera camera;
//自定义菜单栏 1
[MenuItem("ObjectManger/Clone")]//克隆一个物体的菜单选项
static void ClothObject()
{
Instantiate(Selection.activeTransform, Vector3.zero, Quaternion.identity);
}
[MenuItem("ObjectManger/Clone", true)]//设置菜单的激活(当选择物体不为空时设置可用状态
static bool NOClothObject()
{
return Selection.activeObject != null;
}
//自定义菜单栏 2
[MenuItem("ObjectManger/DeleteObject")]//删除一个物体的菜单选项
static void RemoveObject()
{
DestroyImmediate(Selection.activeGameObject, true);
}
[MenuItem("ObjectManger/DeleteObject", true)]//删除一个物体的菜单选项(当选择物体不为空时设置可用状态
static bool NoRemoveObject()
{
return Selection.activeGameObject != null;
}
}