zoukankan      html  css  js  c++  java
  • 【unity基础系列】编辑器类使用例子

     1 using UnityEngine;
     2 using System.Collections;
     3 using UnityEditor;
     4 [ExecuteInEditMode]
     5 public class Data : MonoBehaviour {
     6 
     7 // Use this for initialization
     8 void Start () {
     9 
    10 }
    11 
    12 // Update is called once per frame
    13 void Update () {
    14 
    15 }
    16 
    17 //[MenuItem("Assets/Tools/同步Insp", false, 0)]
    18 //public void ContextMenuFunc2()
    19 //{
    20 // Debug.LogError("hi ,world");
    21 //}
    22 [ContextMenuItem("joitest", "ResetBiography")]
    23 //[Multiline(8)]
    24 public string playerBiography = "";
    25 void ResetBiography()
    26 {
    27 playerBiography = "joi";
    28 }
    29 [ContextMenu("AddTwenAlpha")]
    30 
    31 void AddTwenAlpha()
    32 {
    33 gameObject.AddComponent<TweenAlpha>();
    34 }
    35 
    36 [MenuItem("Assets/Tools/生成CS文件", false)]
    37 public static void JoiTest1() {
    38 Debug.LogError("hi,world");
    39 }
    40 
    41 [MenuItem("GameObject/UI/smile _%#&_HOME", false)]
    42 public static void copyprefabe()
    43 {
    44 Debug.LogError("hi,copyprefabe ");
    45 }
    46 [MenuItem("MenuItem/Selected GameObject", true)]
    47 private static bool CheckObjectType()
    48 {
    49 Object selectedObject = Selection.activeObject;
    50 if (selectedObject != null &&
    51 selectedObject.GetType() == typeof(GameObject))
    52 {
    53 return true;
    54 }
    55 return false;
    56 }
    57 [MenuItem("CONTEXT/Rigidbody/在Rigidbody上右键")]
    58 private static void CONTEXT_Rigidbody_right_btn()
    59 {
    60 Debug.Log("在Rigidbody上右键");
    61 }
    62 }
    喜欢unity 和酷炫的效果。欢迎留言交流。
  • 相关阅读:
    ::selection
    为什么要web语义化
    label的for属性与inputde的id元素绑定
    a 标签
    IE6 双倍距BUG
    css样式书写顺序
    清除浮动 .clearfix
    Unity利用AnimationCurve做物体的各种运动
    Error: unknown argument: '-websockets'
    关闭VAX的拼写检查_解决中文红色警告问题
  • 原文地址:https://www.cnblogs.com/smilejoi/p/7027367.html
Copyright © 2011-2022 走看看