zoukankan      html  css  js  c++  java
  • Unity3D脚本中文系列教程(十六)

    Unity3D脚本中文系列教程(十五)

    ◆ function OnPostprocessAudio (clip:AudioClip):void 
    描述:
    ◆  function OnPostprocessGameObjectWithUserProperties (root : GameObject, propNames : string[], values : object[]) : void

    描述:在导入文件时,为每个至少附加了一个用户属性的游戏物体调用
    propNames是一个string[ ],其中包含了所有找到的属性的名称,该值是一个object[ ],包含了所有实际的值,这个可以是Vector4, bool, string, Color, float, int.类型
    典型的运用是从存储在3dmax中的对象中读取“用户数据”基于什么用户数据被写入到对象,你可以决定以不同的方式来后处理游戏物体。下面的列子中,如果用户数据字符串包含“addboxcollider”添加一个简单的BoxCollider组件
    lass MyPostprocessor extends AssetPostprocessor {
        function OnPostprocessGameObjectWithUserProperties (go : GameObject,propNames : String[], values : System.Object[])
        {
            for (var i : int =0; i!= propNames.Length; i++)
            {    
                var propName : String = propNames[i];
                var value : Object = values[i];
                Debug.Log("Propname: "+propName+" value: "+values[i]);
                if (value.GetType() == String)
                {
                    var s : String = value;
                    if (s.Contains("addboxcollider")) go.AddComponent(BoxCollider);
                } 
                if (value.GetType() == Vector4)
                {
                    var v : Vector4 = value;
                    // do something useful.
                }
                if (value.GetType() == Color)
                {
                    var c : Color = value;
                    // do something useful.
                }
                if (value.GetType() == int)
                {
                    var myInt : int = value;
                    // do something useful.
                }
                if (value.GetType() == float)
                {
                    var myFloat : float = value;
                    // do something useful.
                }
            }
        }
    }
    ◆ function OnPostprocessModel  (root:GameObject):void
    描述:在子类中重载这个函数以便在模型完全导入后获得通知
    在一个预设被生成为游戏物体层次前,root是导入模型的根物体
    class MyModelPostprocessor extends AssetPostprocessor {
        function OnPostprocessModel (g : GameObject) {
            Apply(g.transform);
        }
        // 添加网格碰撞器到每个名称中包含collider的游戏物体上      
        function Apply (transform : Transform)
        {
            if (transform.name.ToLower().Contains("collider"))
            {
                transform.gameObject.AddComponent(MeshCollider);
            }
            // 循环
            for (var child in transform)
                Apply(child);
        }
    }
    ◆ function OnPostprocessTexture  (texture:Teture2D):void
    描述:在子类中重载这个函数以便在纹理被完全导入并被存储到磁盘上之前获取一个通知
    //后期处理所有放置文件夹
    // "invert color" 中的文件,反转他们的颜色
    class InvertColor extends AssetPostprocessor {
        // 使用这个初始化
        function OnPostprocessTexture (texture : Texture2D) {
            // 后期处理只在文件夹
            // "invert color" 或它的子文件夹中的文件
     // var lowerCaseAssetPath = assetPath.ToLower();
            // if (lowerCaseAssetPath.IndexOf ("/invert color/") == -1)
             //return;
            for (var m=0;m<texture.mipmapCount;m++)
            {
                var c : Color[] = texture.GetPixels(m);
                for (var i=0;i<c.Length;i++)
                {
                    c[i].r = 1 - c[i].r;
                    c[i].g = 1 - c[i].g;
                    c[i].b = 1 - c[i].b;
                }
                texture.SetPixels(c, m);
            }
            // 不需要设置每个 mip map 等级图片的像素你也可以只修改最高mip等级的像素并使用texture.Apply(TRUE);来产生较低mip等级
        }
    }
    ◆ function OnPreprocessAudio ():void
    描述:
    ◆ function OnPreprocessModel():void
    描述:在子类中重载这个函数以便在模型被导入前获得一个通知
    这个可以让你为模型的导入设置默认值
    class MyMeshPostprocessor extends AssetPostprocessor {
        function OnPreprocessModel () {
            // 禁用材质生成,如果文件包含@号,表明他是动画
            if (assetPath.Contains("@")) {
                var modelImporter : ModelImporter = assetImporter;
                modelImporter.generateMaterials = 0;
            }
        }
    }
    ◆ function OnPostprocessTexture():void
    描述:在子类中重载这个函数以便在纹理导入器运行前获得一个通知,
    这个可以让你导入设置为默认值
    class MyTexturePostprocessor extends AssetPostprocessor
    {
        function OnPreprocessTexture () {
            // 自动转化任何文件名中带有 "_bumpmap"的纹理文件为法线贴图
           
            if (assetPath.Contains("_bumpmap")) {
                var textureImporter : TextureImporter = assetImporter;
                textureImporter.convertToNormalmap = true;
            }
        }
    }
    BuildPipeline

    类方法
    ◆ static function BuildAssetBundle (mainAsset : Object, assets; Object[].pathName : string,options ; BuildAssetBundleOptions = BuildAssetBundleOptions CollectDependencies
    BuildAssetBundleOptionsCompleteAssets) : bool
    描述:构建资源bundle(Unity Pro only).
       创建一个包含assets集合的压缩Unity3D文件。AssetBundles可以包含工程文件夹中的任何资源,这可以让你流式下载任何类型的资源数据,完整设置的预设,纹理,网格,动画,显示在工程窗口中的任何类型的资源。mainAsset 让你指定一个特定的物体,它可以方便地使用AssetBundle.mainAsset取回。这个压缩的资源bundle文件将被存储在pathName.options允许你自动地包含依赖性或者总是包含完整的资源而不仅仅是引用的对象。
    参见:AssetBundle 类,WWW.assetBundle.
    ◆ Static function BuildPlayer (levels : string[],locationPathName : string,target:BuildTarget,
    Options : BuildOptions) : string.
    描述:构建播放器(Unity Pro only).
    /levels/是被包含在构建中的场景,(如果 levels 为空,当前打开的场景将被构建)locationPathName 是应用程序将被保存的路径,target 是将被构建的 BuildTarget, options是一些额外的选项,如纹理压缩,调试信息剥离。
    ◆ Static function PopAssetDependencies():void
    描述:让你管理不同资源bundle和播放器构建之间的交叉引用和依赖性,
    如果一个资源bundles依赖于另一个资源dundles,确保依赖的资源bundles通过
    WWW类加载是你的责任。
    当你放入资源依赖性时它将共享那个层上的所有资源,放入递归地继承前一个依赖关系,PushAssetDependencies和PopAssetDependencies必须成对出现。
    @lenulten(“Assets/Auto Build Asset Bundles”)
    Static function ExportResource(){
        //对所有下面的资源bundles文件启用交叉引用直到//我们调用PopAssetDependencies
    QuikPipcliPushAssetDcpenclencies();
    Var options=
         BuildAssetBundleOptions CollectDependencies]
         BuildAssetBundleOptions CompleteAssets;
    //所有后续资源共享这个资源bundles中的资源
    //它是由你来确保共享的资源bundle
    //优先于其他资源加载
    Buldpipeline.BuldAssertBundle(
    AssetDatabase.LoadMainAssetAtPath(“assets/artwork/lerpzuv.tif”,
    null,”Sharde.unity3d”,options);
    //通过收入和弹出资源bundle,这个文件
    //将共享资源,但是后面的资源bundle将不会共享这个资源中的资源
    BuildPipeline.PushAssetDependencies();
    BuildPipeline.PushAssetBundle(
    AssetDatabaseLoadMainAssetAtPath(“Asset Artwork/Lerpztbx’),
    Null,”Lerpz.unity3d”,options);
    BuildPipeline.PushAssetDependencies();
    }
    参见:PushAssetDependencies,BuidAssetBundle.
    DragAndDrop

    编辑器拖放操作。
    注意:这是一个编辑器类,为了使用它你必须放置脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加”using UnityEditor,”。
    类变量
    ◆ Static var activeControlID : int
    描述:
    ◆ Static var objectReferences :Object[]
    描述:被拖动的objects的引用。
    没有返回null,如果没有物体引用可用返回一个空的数组。
    参见:paths,PrepareStartDrag,StartDrag,
    ◆ Static var paths :string[]
    描述:被拖放的文件名
    没有返回null。如果没有路径可用返回一个空的数组。
    参见: objectReferences, PrepareStartDrag,StartDrag,.
    ◆ Static var visualMode:DragAndDropVisualMode
    描述:拖放的视觉标志
    默认为DragAndDropVisualMode Link
    function OnGUI ()
    {
    var eventType = Event.current.type;
    if (eventType == EventType.DragUpdated || eventType == EventType.DragPerform)
    {
    // Show a copy icon on the drag
    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
    if (eventType == EventType.DragPerform)
    DragAndDrop.AcceptDrag();
    Event.current.Use();
    }
    }
    类方法
    ◆ Static function AcceptDrag() : void
    描述:接收拖动操作。
    ◆ Static function GetGenericData(type : string) : object
    描述:
    ◆ Static function PrepareStartDrag() : void
    描述:清除拖放数据。
    清楚所有存储在拖放物体中的数据并准备它,这样你可以为初始化一个拖动操作写入它。
    参见:StartDrag,paths,objectReferences.
    function OnGUI ()
    {
    if (Event.current.type == EventType.MouseDrag)
    {
    // 清除拖动数据
    DragAndDrop.PrepareStartDrag ();
    // 设置我们需要拖动什么
    DragAndDrop.paths = { "/Users/joe/myPath.txt" };
    // 开始拖动
    DragAndDrop.StartDrag ("Dragging title");
    // 确保我们之后没有人使用这个事件
    Event.current.Use();
    }
    }
    ◆ Static function SetGenericData(type:string,data:object) : void
    描述:
    ◆ Static function StartDrag(title:string): void
    描述:开始拖动操作。
    用当前拖动物体状态初始化一个拖动操作。使用paths和/或objectReferences来设置拖动状态。
    参见:PrepareStartDrag,paths,objectReferences.
    function OnGUI ()
    {
    if (Event.current.type == EventType.MouseDrag)
    {
    // 清除拖动数据
    DragAndDrop.PrepareStartDrag ();
    // 设置我们需要拖动什么
    DragAndDrop.paths = { "/Users/joe/myPath.txt" };
    // 开始拖动
    DragAndDrop.StartDrag ("Dragging title");
    // 确保我们之后没有人使用这个事件
    Event.current.Use();
    }
    }
    DrawGizmo
    类,继承自System Attribute
    DrawGizmo属性允许你为任何类型的Compartent提供一个gizmo渲染器。
    注意:这是一个编辑器类,为了使用它你必须放置脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加”using UnityEditor”.
      目前,z你只能为引擎组件提供gizmo绘制,所有的gizmo绘制方法需要是静态的,
    //如果这个光源没有被选择将调用RenderLightGizmo函数
    //当拾取时gizmo被绘制
    @DrawGizmo (GizmoType.NotSelected | GizmoType.Pickable)
    static function RenderLightGizmo (light : Light, gizmoType : GizmoType)
    {
    var position = light.transform.position;
    // 绘制光源图标
    // 在内置的光源Gizmo上面一点)
    Gizmos.DrawIcon (position + Vector3.up, "Light Gizmo.tiff");
    // 我们选择了吗? Draw a solid sphere surrounding the light
    if ((gizmoType & GizmoType.SelectedOrChild) != 0)
    {
    // 使用一个较为明亮的颜色表明这是一个活动对象.
    if ((gizmoType & GizmoType.Active) != 0)
    Gizmos.color = Color.red;
    else
    Gizmos.color = Color.red * 0.5;
    Gizmos.DrawSphere (position, light.range);
    }
    }
    /// C# 例子
    using UnityEditor;
    using UnityEngine;
    class GizmoTest
    {
    /// 如果这个光源没有被选择调用RenderLightGizmo函数.
    /// 当拾取时gizmo被绘制.
    [DrawGizmo (GizmoType.NotSelected | GizmoType.Pickable)]
    static void RenderLightGizmo (Light light, GizmoType gizmoType)
    {
    Vector3 position = light.transform.position;
    // 绘制光源图标
    // (在内置的光源Gizmo上面一点)
    Gizmos.DrawIcon (position + Vector3.up, "Light Gizmo.tiff");
    // 我们选择了吗?围绕光源绘制一个球体
    if ((gizmoType & GizmoType.SelectedOrChild) != 0)
    {
    //使用一个较为明亮的颜色表明这是一个活动对象.
    if ((gizmoType & GizmoType.Active) != 0)
    Gizmos.color = Color.red;
     
    else
    Gizmos.color = Color.red * 0.5F;
    Gizmos.DrawSphere (position, light.range);
    }
    }
    }
    构造函数
    ◆ Static function DrawGizmo(gizmo: GizmoType): DrawGizmo
    描述:定义何时Gizmo应该被调用以便绘制。
    参见: GizmoType
    ◆ Static function DrawGizmo(gizmo: GizmoType,drawnGizmoType:Type):DrawGizmo
    描述:同上,drawnGizmoType决定要绘制的Gizmo物体是什么类型的。
    如果drawnGizmoType为null,这个类型将由该函数的第一个参数决定。
    Editor
    类,继承自ScriptableObject
    一个基类,可以从它派生自定义的编辑器,使用这个给你的物体创建自定义的检视面板和编辑器。
    注意:这是一个编辑器类。为了使用它你必须放置脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加”using UnityEditor,”。
    通过使用CustomEditor属性可以附加Editor到一个自定义的组件。
    JavaScript例子:
    //这个例子为一个”MyPlayer”物体显示一个自定义的检视面板。
    它有两个变量,speed和ammo.
    @CustomEditor(MyPlayer)
    class MyPlayerEditor extends Editor
    {
    function OnInspectorGUI()
    {
    EditorGUILayout.BeginHorizontal();
    EditorGUILayout.PrefixLabel("Speed");
    target.speed = EditorGUILayout.Slider(target.speed, 0, 100);
    EditorGUILayout.EndHorizontal();
    EditorGUILayout.BeginHorizontal();
    EditorGUILayout.PrefixLabel("Ammo");
    target.ammo = EditorGUILayout.IntField(target.ammo);
    EditorGUILayout.EndHorizontal();
    }
    }
    变量
    ◆ Var target:Object
    描述:被检视的对象
    消息传递
    ◆ Function OnInspectorGUI():void
    描述:实现这个函数来制作一个自定义的检视面板。
    ◆ Function OnSceneGUI() : void
    描述:在场景视图中让编辑器处理一个事件。
    在OnSceneGUI中你可以做,例如网格编辑,地形绘制或高级的gizmos,如果调用Eventcurrent,Use(),该事件将被编辑处理并不会被场景视图使用。
    继承的成员
    继承的变量
    name                       对象的名称
    hideFlags                    该物体是否被隐藏,保存在场景中或被用户修改
    继承的函数
    GetInstanceID                返回该物体的实例ID
    继承的消息传递
    OnEnable                    物体被加载时调用该函数
    OnDisable                   当可编辑物体超出范围时调用这个函数
    继承的类函数
    CreateInstance               使用className创建一个可编程物体的实例。
    operatorbool                这个物体存在吗
    Instannate                  克隆original物体并返回这个克隆
    Destroy                    移除一个游戏物体,组件或资源
    DestroyImmediate           立即销毁物体obj,强力建议使用Destroy代替
    FindObjectsOFType         返回所有类型为type的激活物体
    FindObjectOFType          返回第一个类型为type的激活物体
    Operator==                比较两个物体是否相同
    Operator!=               比较两个物体是否不相同
    DontDestroyOnLoad        加载新场景时确保物体target不被自动销毁。
    EditorApplication

    注意:这是一个编辑器类。为了使用它你必须放置脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加”using UnityEditor,”。
    类变量
    ◆ Static var applicationContentsPath:string
    描述:Unity编辑器内容文件的路径(只读)
    这个内容文件夹包含用来构建播放器的一些内部文件。
    ◆ Static var applicationPath:string
    描述:返回Unity编辑器的路径(只读)
    参见:applicationContentsPath
    ◆ Static var currentScene:string
    描述:用户当前打开的场景的路径(只读)。
    ◆ Static var isPaused : bool
    描述:编辑器当前暂停?
    可编辑地改变暂停状态,就像按下主工具栏上的Pause按钮。
    参见:isPlaying.
    ◆ Static var isPlaying : bool
    描述:编辑器当前处于播放模式?
    isPaying的设置会延迟直到到该帧中所有的脚本代码已经完成。
    ◆ Static var isPlayingOrWillChangePlaymode : bool
    描述:编辑器当前处于播放模式,或者将切换到播放模式?(只读)
    当编辑器在完成某些任务(例如,在脚本被重编译之后)后将切换到播放模式时,这个将返回真。
    参见:isPlaying,isCompiling.
    类方法
    ◆ Static function Beep():void
    描述:播放系统哔哔声
    //在鼠标按下事件中播放声音
    Function OnGUI(){
      if (Event.current.type == EventType.MouseDrag)
           EditorApplication.Bceo();
    }
    ◆ Static function Exit(returnValue:int):void
    描述:退出Unity编辑器。
    调用这个函数将立即退出,不会询问保存改变,因此你将丢失数据!
    ◆ Static function LockReloadAssemblies():void
    描述:当不方便的时候阻止部件的加载。
    例如,在拖动操作的时候,你也许想阻止部件的重加载以便在拖动过程中不会丢失状态。
    每个LockReloadAssemblies必须与UnLockReloadAssemblies匹配,否则脚本将不会被卸载。Unity自动在鼠标按下的时候阻止重加载。
    参见:EditorApplication. UnLockReloadAssemblies
    ◆ Static function NewScene():void
    描述:创建新的场景。
    ◆ Static function OpenScene(path:string):bool
    描述:打开位于Path的场景。
    当前打开的场景不会被保存,使用SaveSceneIfUserWantsTo来做这个。
    ◆ Static function OpenSceneAdditive(path:string):void
    描述:打开位于path的附加场景。
    ◆ Static function SaveAssets ():void
    描述:保存所有还没有写到磁盘的可序列化资源(例如,材质)
    也确保资源数据库被写入。
    ◆ Static function SaveCurrentSceneIfUserWantsTo():bool
    描述:询问用户是否要保存打开的场景。
    你可能想在打开其他场景或创建一个新的场景时调用这个函数。返回真表示你想继续。返回为假表示用户要取消这个操作,因此不应该打开其他场景。
    ◆ Static function SaveScene(path:string):bool
    描述:保存场景到path.
    ◆ Static function Step():voidl
    描述:执行单帧步进。
    就像你按下了主打工具栏上的Step按钮。
    ◆ Static function UnLockReloadAssemblies ():voidl
    描述:必须在LockReloadAssemblies之后调用,来重启用集合的加载。
    参见:EditorApplication, LockReloadAssemblies
                      EditorGUILayout
         类
         EditorGUI的自动布局版本
     注意:这是一个编辑器类。为了使用它你必须放置脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加”using UnityEditor,”。
    类方法
    ◆ Static function BeginHorizontal(params options:GUILayoutOption[]):Rect
    ◆ Static function BeginHorizontal(style:GUIStyle, params options:GUILayoutOption[]):Rect
    参数
    Style             可选的GUIStyle
    Options           一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置
                参见:GUIlayout,Width,GUILayout,Height,GUILayout MinWidth,
                      GUILayout MaxWidth, GUILayout MinHeight, GUILayout MaxHeight
                      GUILayout ExpandWidth, GUILayout ExpandHeight,
    描述:开始一个水平组并获取它的矩形。
    这是GUILayout BeginHorizontal的扩展,用来制作组合控件。
    //组合按钮
    Rect r = EditorGUILayout.BeginHorizontal ("Button");
    if (GUI.Button (r, GUIContent.none))
    Debug.Log ("Go here");
    GUILayout.Label ("I'm inside the button");
    GUILayout.Label ("So am I");
    EditorGUILayout.EndHorizontal ();
    ◆ Static function BeginScrollView (scrollPosition : Vector2,  params options:GUILayoutOption[]):Vector2
    static function BeginScrollView (scrollPosition : Vector2, alwaysShowHorizontal : bool, alwaysShowVertical : bool, horizontalScrollbar : GUIStyle, verticalScrollbar : GUIStyle, params options : GUILayoutOption[]) : Vector2
    参数
    scrollPosition              用来显示的位置
    alwaysShowHorizontal       可选的参数用来总是显示水平滚动条,如果为黑线留空,它就只在ScrollView中的内容比滚动提高时显示。
    alwaysShowVertical         可选的参数用来总是显示垂直滚动条,如果为黑线留空,它就只在ScrollView中的内容比滚动提高时显示。
    horizontalScrollbar          用于水平滚动条的可选GUIStyle,如果不设置,将使用当前GUISkin的horizontalScrollbar
    verticalScrollbar               用于垂直滚动条的可选GUIStyle,如果不设置,将使用当前GUISkin的verticalScrollbar风格。
    返回:Vector2,修改过的scrollPosition,回传这个变量,如下的例子。
    描述:开始有个自动布局滚动条。
    这个就像GUILayout BeginScrollView一样,但是更像应用程序且应该在编辑器中使用。
    ◆ static function BeginToggleGroup (label : string, toggle : bool) : bool
    ◆ static function BeginToggleGroup (label : GUIContent, toggle : bool) : bool
    参数
    label           显示在开关控件上的标签
    toggle          开关组的启用状态
    返回bool – 用户选择的启用状态。
    描述:开始一个带有开关的组,以便一次启用或禁用其中的所有控件。
    参见:EndToggleGroup
    // 设置
    settingsOn = EditorGUILayout.BeginToggleGroup("Settings", settingsOn);
    backgroundColor = EditorGUILayout.ColorField(backgroundColor);
    soundOn = EditorGUILayout.Toggle(soundOn, "Turn on sound");
    EditorGUILayout.EndToggleGroup();
    ◆ static function BeginVertical (params options : GUILayoutOption[ ]) : Rect
    ◆ static function BeginVertical (style : GUIStyle, params options : GUILayoutOption[ ]) :Rect
    参数
    Style               可选的GUIStyle
    Options             一个可选的布局选项的列表,它用来指定程序的布局属性,任何在这里设置的值将覆盖由style定义的设置
                        参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight.
    描述:开始一个垂直组并获取它的矩形。
    这是GUILayout.BeginVertical的扩展,用来制作组合控件。
    // 组合按钮
    Rect r = EditorGUILayout.BeginVertical ("Button");
    if (GUI.Button (r, GUIContent.none))
    Debug.Log ("Go here");
    GUILayout.Label ("I'm inside the button");
    GUILayout.Label ("So am I");
    EditorGUILayout.EndVertical ();
    ◆ static function ColorField (value : Color, params options : GUILayoutOption[ ]) : Color
    ◆ static function ColorField (label : string, value : Color, params options : GUILayoutOption[ ]) : Color
    ◆ static function ColorField (label : GUIContent, value : Color,
    params options : GUILayoutOption[ ]) : Color
    参数
    Label          显示在该域前面的可选标签。
    Value          用于编辑的颜色
    Options        一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置。
                   参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    返回:Color- 用户选择的颜色
    描述:制作一个用来选择Color的域
    ◆ static function EndHorizontal () : void
    描述:关闭一个开始于BeginHorizontal的组
    ◆ static function EndScrollView () : void
    描述:结束开始于BeginScrollView的滚动视。
    ◆ static function EndToggleGroup () : void
    描述:关闭一个开始于BeginToggleGroup
    // Settings
    settingsOn = EditorGUILayout.BeginToggleGroup("Settings", settingsOn);
    backgroundColor = EditorGUILayout.ColorField(backgroundColor);
    soundOn = EditorGUILayout.Toggle(soundOn, "Turn on sound");
    EditorGUILayout.EndToggleGroup();
    ◆ static function EndVertical () : void
    描述:关闭一个开始于BeginVertical的组
    ◆ static function EnumPopup (label : GUIContent, selected : System.Enum, style : GUIStyle, params options : GUILayoutOption[ ]) : System.Enum
    参数
    label         该域前面可选的标签 
    selected      该域显示的选项
    style          可选的GUIStyle 
    options        一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由Sryle定义的设置。
                  参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    返回:floar-被用户选择的选项
    描述:制作一个弹出式选择域
    使用当前选择的值作为参数并返回用户选择的值。
    ◆ static function FloatField (label : GUIContent, value : float, style : GUIStyle, params options : GUILayoutOption[]) : float
    参数
    Label             显示在浮点域前面的可选标签。
    Value             用于编辑的值
    Style              可选的GUIStyle
    Options            一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。
                       参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    返回:float – 用户输入的值
    描述:制作一个文本域以便输入浮点数。
    ◆ static function Foldout (foldout : bool, content : string, style : GUIStyle = EditorStyles.foldout) : bool
    ◆ static function Foldout (foldout : bool, content : GUIContent, style : GUIStyle = EditorStyles.foldout) : bool
     
    参数
    Foldout                显示折叠状态
    Content             显示的标签
    Style                可选的GUIStyle
    返回:bool – 用户选择的折叠状态,如果为真,应该渲染子对象。
    描述:制作一个左侧带有折叠箭头的标签。
    这可以用来创建一个树或文件夹结构,这里子对象只在夫展开的时候显示
    ◆ static function InspectorTitlebar (foldout : bool, targetObj : Object) : bool
    参数
    Foldout                   折叠状态用这个箭头显示。
    targetObj                  使用该标题栏的对象(例如组件)
    返回:bool – 用户选择的折叠状态
    描述:制作一个检视窗口标题栏
    该标题栏有一个折叠箭头,一个帮助图标和一个设置菜单,设置菜单依赖于所提供的对象的类型。
    ◆ static function IntField (value : int, params options : GUILayoutOption[ ]) : int
    ◆ static function IntField (value : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆ static function IntField (label : string, value : int, params options : GUILayoutOption[ ]) : int
    ◆ static function IntField (label : string, value : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆ static function IntField (label : GUIContent, value : int, params options : GUILayoutOption[ ]) : int
    ◆ static function IntField (label : GUIContent, value : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
    参数
    Label                        显示在该整型域前面的可选标签。
    Value                        用于编辑的值
    Style                         可选的GUIStyle
    Options                      一个可选的布局选项的列表,它用来指定额外的布局
                                 属性。任何在这里设置的值将覆盖由style定义的设置
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    返回:int – 用户输入的值。
    描述:制作一个文本域以便输入整数。
    ◆  static function IntPopup (selectedValue : int, displayedOptions : string[ ], optionValues : int[ ], params options : GUILayoutOption[ ]) : int
             参数
             Label                该域前面可选的标签。
             selectedValue        该域显示的选项的值
             displayedOptions     一个带有显示X显示选项的数组,用户可以从中选择。
             optionValues         一个为每个选项存储值得数组。
             Style                可选的GUIStyle
              Options             一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。
                                   参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
               返回:int – 被用户选择的选项的值
               描述:制作一个整形弹出式选择域
               使用当前选择的整数作为参数并返回用户选择的整数。
    ◆  static function IntSlider (value : int, leftValue : int, rightValue : int, params options : GUILayoutOption[ ]) : int
    ◆  static function IntSlider (label : string, value : int, leftValue : int, rightValue : int, params options : GUILayoutOption[ ]) : int
    ◆ static function IntSlider (label : GUIContent, value : int, leftValue : int, rightValue : int, params options : GUILayoutOption[ ]) : int
         参数
         Label                     该滑杆前面可选的标签。
         Value                     滑杆显示的值。这个决定可拖动滑块的位置。
         leftValue                  滑杆左端的值
     
         rightValue                 滑杆右端的值
         options                    一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置
                                   参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
          返回:int – 被用户设置的值
          描述:制作一个用户可以拖动到滑杆可以在min和max之前改变一个整数值。
    ◆ static function LabelField (label : string, label2 : string, params options : GUILayoutOption[ ]) : void
    参数
    Label                      该域前面的标签
    Label2                     显示在右侧的标签
    Options                     一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
                               参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    描述:制作一个标签域(用来显示只读信息)
    ◆   static function LayerField (layer : int, params options : GUILayoutOption[ ]) : int
    ◆   static function LayerField (layer : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆   static function LayerField (label : string, layer : int, params options : GUILayoutOption[ ]) : int
    ◆   static function LayerField (label : string, layer : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆   static function LayerField (label : GUIContent, layer : int, params options : GUILayoutOption[ ]) : int
    ◆   static function LayerField (label : GUIContent, layer : int, style : GUIStyle, params options : GUILayoutOption[ ]) : int
          参数
          Label                       该域前面可选的标签
          Layer                       显示在该域中的层
          Style                        可选的GUIStyle
          Options                      一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
                                       参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
            返回:int – 用户选择的层
     
            描述:制作一个层选择域
    ◆ static function ObjectField (obj : Object, objType : System.Type, params options : GUILayoutOption[ ]) : Object
    ◆ static function ObjectField (label : string, obj : Object, objType : System.Type, params options : GUILayoutOption[ ]) : Object
    ◆ static function ObjectField (label : GUIContent, obj : Object, objType : System.Type, params options : GUILayoutOption[ ]) : Object
    参数
    Label                           该域前面可选的标签
    Obj                             该域显示的对象
    objType                         对象的类型
    options                          一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置。
                                           参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight 
         返回:Object – 被用户设置的对象
         描述:制作一个物体放置槽域
    ◆   static function PasswordField (password : string, params options : GUILayoutOption[ ]) : string
    ◆   static function PasswordField (password : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆   static function PasswordField (label : string, password : string, params options : GUILayoutOption[ ]) : string
    ◆   static function PasswordField (label : string, password : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆   static function PasswordField (label : GUIContent, password : string, params options : GUILayoutOption[ ]) : string
    ◆   static function PasswordField (label : GUIContent, password : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
          参数
          Label                显示在该密码域前面的可选标签
          Password          用于编辑的密码
          Style               可选的GUIStyle
          Options             一个可选的布局选项的列表,它用来指定额外iad布局属性
    任何在这里设置的值将覆盖由style定义的设置
    参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight,
     
    GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回:string – 用户输入的密码
           描述:制作一个用户可以输入密码的文本域
             这个就像GUILayoutPasswordField,但是正确的响应所有选择,在编辑器中,可以有一个可选的标签在前面。
    ◆   static function Popup (selectedIndex : int, displayedOptions : string[ ], params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (selectedIndex : int, displayedOptions : string[ ], style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (selectedIndex : int, displayedOptions : GUIContent[ ], params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (selectedIndex : int, displayedOptions : GUIContent[ ], style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (label : string, selectedIndex : int, displayedOptions : string[ ], params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (label : string, selectedIndex : int, displayedOptions : string[ ], style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆   static function Popup (label : GUIContent, selectedIndex : int, displayedOptions : GUIContent[], params options : GUILayoutOption[ ]) : int

    ◆ static function Popup (label : GUIContent, selectedIndex : int, displayedOptions : GUIContent[ ], style : GUIStyle, params options : GUILayoutOption[ ]) : int
    ◆ 
           参数
           Label                  该域前面可选的标签
          selectedIndex           该域显示的选项的索引
          displayedOptions        显示在弹出菜单中的选项数组
          style                   可选的GUIStyle
          options                 一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置
                                  参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回:int – 被用户选择的选项的索引
           描述:制作一个通用的弹出式选择域
           使用当前选择的索引作为参数并返回用户选择的索引
    ◆   static function PrefixLabel (label : string, followingStyle : GUIStyle = "Button") : void
    ◆   static function PrefixLabel (label : string, followingStyle : GUIStyle, labelStyle : GUIStyle) : void
    ◆   static function PrefixLabel (label : GUIContent, followingStyle : GUIStyle = "Button") :
    void
    ◆   static function PrefixLabel (label : GUIContent, followingStyle : GUIStyle, labelStyle : GUIStyle) : void
           参数
           Label                  显示在控件前面的标签
           描述:在一些控件前面制作一个标签。
           GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
    ◆   static function RectField (value : Rect, params options : GUILayoutOption[ ]) : Rect
    ◆   static function RectField (label : string, value : Rect, params options : GUILayoutOption[ ]) : Rect
    ◆   static function RectField (label : GUIContent, value : Rect, params options : GUILayoutOption[ ]) : Rect
         参数
         Label                    显示在该域上的标签
         Value                    用于编辑的值
         Options                  一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置
                                  参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
          返回:Rect – 用户输入的值
          描述:制作一个X,Y,W&H域以便输入一个Rect。
    ◆ static function Separator () : void
    描述:在前一个控件和后面的控件之前制作一个小的分隔符。
    ◆  static function Slider (value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[ ]) : float
    ◆  static function Slider (label : string, value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[ ]) : float
    ◆  static function Slider (label : GUIContent, value : float, leftValue : float, rightValue : float, params options : GUILayoutOption[ ]) : float
         参数
         Label                 该滑杆前面可选的标签
         Value                 滑杆显示的值,这个决定可拖动滑块的位置。
         leftValue              滑杆左端的值
         rightValue             滑杆右端的值
         options                一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置
    参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
        返回:float – 被用户设置的值
        描述:一个用户可以拖动到滑杆,可以在min和max之前改变一个值。
    ◆ static function Space():void
    描述:在前一个控件和后面的控件之间制作一个小的空格。
    ◆   static function TagField (tag : string, params options : GUILayoutOption[ ]) : string
    ◆   static function TagField (tag : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆   static function TagField (label : string, tag : string, params options : GUILayoutOption[ ]) : string
    ◆   static function TagField (label : string, tag : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆   static function TagField (label : GUIContent, tag : string, params options : GUILayoutOption[ ]) : string
    ◆   static function TagField (label : GUIContent, tag : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
          参数
          Label                 该域前面可选定标签
          Tag                   该域显示的标签
          Style                  可选的GUIStyle
          Options               一个可选的布局选项的列表,它用来指定额外的布局属性。任何在这里设置的值将覆盖由style定义的设置。
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
            返回:string – 用户选择的标签
            描述:制作一个标签选择域

    ◆   static function TextArea (text : string, params options : GUILayoutOption[ ]) : string
    ◆  static function TextArea (text : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
          参数
          Text                   用于编辑的文本
          Style                   可选的GUIStyle
          Options                一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
            返回:string – 用户输入的文本
            描述:制作一个文本区域
            这个就像GUIlayout。TextArea一样。但是正确地响应全选,拷贝,粘帖等。在编辑器中
    ◆    static function TextField (text : string, params options : GUILayoutOption[ ]) : string
    ◆    static function TextField (text : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆    static function TextField (label : string, text : string, params options : GUILayoutOption[ ]) : string
    ◆    static function TextField (label : string, text : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
    ◆    static function TextField (label : GUIContent, text : string, params options : GUILayoutOption[ ]) : string
    ◆    static function TextField (label : GUIContent, text : string, style : GUIStyle, params options : GUILayoutOption[ ]) : string
            参数
            Label                 显示在该文本前面的可选标签
            Text                   用于编辑的文本
          Style                   可选的GUIStyle
          Options                一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
            返回:string – 用户输入的文本
            描述:制作一个文本区域
            这个就像GUIlayout。TextField一样。但是正确地响应全选,拷贝,粘帖等。在编辑器中,可以有一个可选的标签在前面
    ◆    static function Toggle (value : bool, params options : GUILayoutOption[ ]) : bool
    ◆    static function Toggle (label : string, value : bool, params options : GUILayoutOption[ ]) : bool
    ◆    static function Toggle (label : GUIContent, value : bool, params options : GUILayoutOption[ ]) : bool
           参数
           Label                 该开关前面可选的标签
           Value                 这个开关的显示状态
           Options               一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
     
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回: bool – 这个开关的显示状态
           描述: 制作一个开关
    ◆    static function Vector2Field (label : string, value : Vector2, params options : GUILayoutOption[ ]) : Vector2
           参数
           Label                 显示在该域上的标签
           Value                 用于编辑的值
           Options               一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
           参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回:Vector2 – 用户输入的值
           描述:制作一个X&Y域以便输入一个Vector2
    ◆    static function Vector3Field (label : string, value : Vector3, params options :         GUILayoutOption[ ]) : Vector3
           参数
           Label                 显示在该域上的标签
           Value                 用于编辑的值
           Options               一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
               参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回:Vector3 – 用户输入的值
           描述:制作一个X&Y域以便输入一个Vector3
    ◆    static function Vector4Field (label : string, value : Vector4, params options :         GUILayoutOption[ ]) : Vector4
           参数
           Label                 显示在该域上的标签
           Value                 用于编辑的值
           Options               一个可选的布局选项的列表,它用来指定额外的布局属性,任何在这里设置的值将覆盖由style定义的设置
                                 参见:GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
           返回:Vector4 – 用户输入的值
           描述:制作一个X&Y域以便输入一个Vector4
        EditorGUIUtility
       类,继承自GUIUility
    用户EditorGUI的各种辅助函数
       注意:这是一个编辑器类。为了使用它你必须防止脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加“usingUnityEditor”
    变量
    ◆statie var systemCopyBuffer:string
    描述:系统拷贝缓存
    使用这个使拷贝和粘贴为你自己的数据工作
    ◆statie var whiteTexture:Texture2D
    描述:获取一个白色纹理
    类方法
    ◆statie function AddCursorRect(position:Rect,mouse:MouseCursor):void
    参数
    position                 显示控件的矩形
    mouse                  使用鼠标光标
    描述:添加一个自定义的鼠标光标到一个控件
    function OnGUI()
    {
        // 当鼠标悬停在这个矩形上时,显示“link”光标
        EditorGUIUtility.AddCursorRect (Rect(10,10,100,100), MouseCursor.Link);       
    }
    ◆static function DrawColorSwatch (position : Rect, color : Color) : void
    参数
    position                 绘制样板颜色的矩形。Color绘制颜色
    描述:绘制一个颜色样本
    ◆static function FindTexture (name : string) : Texture2D
     描述:从源文件名获取一个纹理
    ◆static function HasObjectThumbnail (objType : Type) : bool
    描述:给定的类有对象有小物体
    ◆static function Load (path : string) : Object
    描述:加载一个内置资源
    这个函数将在Assets/Editor Default Resources/ + path中查找资源,如果没有,它将按照名称尝试内置的编辑器资源
    var handleMaterial : Material = EditorGUIUtility.Load (Load("HandleMaterial.mat"));
    ◆static function LoadRequired (path : string) : Object
    描述:加载位于路径上的内置资源
    这个函数将在Assets/Editor Default Resources/ + path中查找任何资源。
    var handleMaterial : Material = EditorGUIUtility.Load (Load("HandleMaterial"));
    ◆ static function LookLikeControls (labelWidth : float = 100, fieldWidth : float = 70) : void
    ◆ 
    参数
    labelWidth  用于前缀标签的宽带
    fieldWidth     文本条目的宽度。参见:LookLikeInspector
    描述:使所有ref::EditorGUI外观像普通控件
    这将使EditorGUI::ref::使用默认风格,看起来想控件(例如e.g. EditorGUI.Popup成为一个完全是弹出菜单)
    ◆  static function LookLikeInspector () : void
    描述:使所有ref::EditorGUI外观像简化边框的视控件
    这个将使EditorGUI使用的默认风格的外观就像它在检视面板中一样
    参见:LookLikeControls
    ◆  static function ObjectContent (obj : Object, type : System.Type) : GUIContent
    描述:返回一个带有名称和图标的GUIContent物体
    如果物体为空,图标将根据类型选择
    ◆  static function PingObject (obj : Object) : void
    描述:Ping窗口中的一个对象,就像在检视面板中点击它
    ◆  static function QueueGameViewInputEvent (evt : Event) : void
    描述:发送一个输入事件到游戏
    ◆ static function RenderGameViewCameras (cameraRect : Rect, statsRect : Rect, stats : bool, gizmos : bool) : void
    cameraRect  用于渲染所有游戏相机的设备坐标
    statsRect      统计应该显示的地方
    stats          叠加显示统计数据
    gizmos      也显示gizmos
    描述:渲染所有游戏内的相机
    继承的成员
    继承的类变量
    hotControl          当前具有热点的控件controlID
    keyboardControl  具有键盘焦点控件的controlID
    继承的类函数
    GetControlID      为一个控件获取唯一ID
    GetStateObject      从一个 controlID.获取一个状态
    QueryStateObject  从一个 controlID.获取一个存在的状态物体
    MoveNextAndScroll  只允许从 OnGUI内部调用GUI函数
    GUIToScreenPoint  将一个点从GUI位置转化为屏幕空间
    ScreenToGUIPoint  将一个点从屏幕空间转化为GUI位置
    RotateAroundPivot  使GUI围绕一个点选择的辅助函数
    ScaleAroundPivot 
    EditorGUI

    只用于编辑器GUI的类,这个类包含了附加到UnityGUI的通用2D元素
       注意:这是一个编辑器类。为了使用它你必须防止脚本到工程文件夹的Assets/Editor中,编辑器类位于UnityEditor命名空间因此对于C#脚本你需要在脚本开始位置添加“usingUnityEditor”
       这些工作的非常像普通的GUI函数,在EditorGUILayout中也有相同实现
    类变量
    static var actionKey : bool
    描述:平台相关的"action"调整键被按下(只读)
    Mac OS X为 Command, Windows上为Control
    类方法
    ◆static function ColorField (position : Rect, value : Color) : Color
    ◆static function ColorField (position : Rect, label : string, value : Color) : Color
    ◆static function ColorField (position : Rect, label : GUIContent, value : Color) : Color
      参数
      position      屏幕上用于域的矩形区域
    label      显示在该域前面的可选标签
    value      用于编辑的颜色
    返回:Color – 用户选择的颜色
    描述:制作一个用来选择Color的域
    ◆static function DrawTextureAlpha (position : Rect, image : Texture, scaleMode : ScaleMode = ScaleMode.StretchToFill, imageAspect : float) : void
    参数
    position     屏幕上用来绘制纹理的矩形区域
    image     显示的Texture
    scaleMode 当纹理的长宽比不适合绘制的长宽比时如何缩放这个图片
    alphaBlend 是否用 alpha 混合显示图片(默认)如果为假,图片将绘制到屏幕
    imageAspect 用于源图像的宽高比,如果为0(默认),使用来自图片的宽高比
    描述:在一个矩形中绘制纹理的alpha通道
    参见: GUI.color, GUI.contentColor
    ◆static function EnumPopup (position : Rect, selected : System.Enum, style : GUIStyle = EditorStyles.popup) : System.Enum
    ◆static function EnumPopup (position : Rect, label : string, selected : System.Enum, style : GUIStyle = EditorStyles.popup) : System.Enum
    ◆static function EnumPopup (position : Rect, label : GUIContent, selected : System.Enum, style : GUIStyle = EditorStyles.popup) : System.Enum
    参数
    position     屏幕上用来绘制纹理的矩形区域
    label         该域前面可选的标签
    selected     该域显示的选项
    style         可选的GUIStyle.
    返回:float-   被用户选择的选项
    描述:制作一个弹出式选择域
    使用当前选择的值作为参数并返回用户选择的值
    ◆static function FloatField (position : Rect, value : float, style : GUIStyle = EditorStyles.numberField) : float
    ◆static function FloatField (position : Rect, label : string, value : float, style : GUIStyle = EditorStyles.numberField) : float
    ◆static function FloatField (position : Rect, label : GUIContent, value : float, style : GUIStyle = EditorStyles.numberField) : float
    参数
    position     屏幕上用来浮点值的矩形区域
    label         显示在浮点域前面的可选标签
    value       该域显示的选项
    style         可选的GUIStyle.
    返回:float-   被用户输入的值
    描述:制作一个文本域以便输入浮点值
    ◆static function Foldout (position : Rect, foldout : bool, content : string, style : GUIStyle = EditorStyles.foldout) : bool
    ◆static function Foldout (position : Rect, foldout : bool, content : GUIContent, style : GUIStyle = EditorStyles.foldout) : bool
    参数
    position     屏幕上用于箭头和标签的矩形区域
    foldout       显示折叠状态
    content       显示的标签
    style         可选的GUIStyle.
    返回:bool-   用户选择的折叠状态,如果为真,应该渲染子对象
    描述:制作一个左侧带有折叠箭头的标签
    这个可以用来创建一个树或则文件夹结构,这里子对象只在父展开的时候显示
    ◆ static function InspectorTitlebar (position : Rect, foldout : bool, targetObj : Object) : bool
    参数
    position     屏幕上用于标题栏的矩形区域
    foldout       显示折叠状态
    targetObj   使用该标题栏的对象
    返回:bool-   用户选择的折叠状态
    描述:制作一个检视窗口标题栏
    该标题栏有一个折叠箭头,一个帮助图标和设置菜单,设置菜单以来于所提供对象类型
    ◆static function IntField (position : Rect, value : int, style : GUIStyle = EditorStyles.numberField) : int
    ◆static function IntField (position : Rect, label : string, value : int, style : GUIStyle = EditorStyles.numberField) : int
    ◆static function IntField (position : Rect, label : GUIContent, value : int, style : GUIStyle = EditorStyles.numberField) : int
    参数
    position     屏幕上用于整型域的矩形区域
    label         显示在该整型域前面的可选标签
    value       用于编辑的值
    style         可选的GUIStyle.
    返回:int-  用户输入的值
    描述:制作一个文本域以便输入整数
    ◆static function IntPopup (position : Rect, selectedValue : int, displayedOptions : string[], optionValues : int[], style : GUIStyle = EditorStyles.popup) : int
    ◆static function IntPopup (position : Rect, selectedValue : int, displayedOptions : GUIContent[], optionValues : int[], style : GUIStyle = EditorStyles.popup) : int
    ◆static function IntPopup (position : Rect, label : string, selectedValue : int, displayedOptions : string[], optionValues : int[], style : GUIStyle = EditorStyles.popup) : int
    ◆static function IntPopup (position : Rect, label : GUIContent, selectedValue : int, displayedOptions :
    GUIContent[], optionValues : int[], style : GUIStyle = EditorStyles.popup) : int
    参数
    position             屏幕上用于域的矩形区域
    label                 可选标签
    selectedValue       显示的选项的值
    displayedOptions       一个带有显示X选项的数组,用户可以选择
    optionValues           一个为每个选项存储值的数组
    style                 可选的GUIStyle.
    返回:int- 被用户选择的值
    描述:制作一个整形弹出式选择域
    只用当前选择的整数作为参数并返回用户选择的整数
    ◆static function IntSlider (position : Rect, value : int, leftValue : int, rightValue : int) : int
    ◆static function IntSlider (position : Rect, label : string, value : int, leftValue : int, rightValue : int) : int
    ◆static function IntSlider (position : Rect, label : GUIContent, value : int, leftValue : int, rightValue : int) : int
    参数
    position     屏幕上用于滑竿的矩形区域
    label         该滑竿前面可选择的标签
    value         滑竿显示的值
    leftValue     滑竿左端值
    rightValue    滑竿右端值
    返回:int-   用户设置的值
    描述:制作一个可以拖动的滑竿,可以在min和max之间设置参数

  • 相关阅读:
    Centos开启FTP及用户配置
    mysql update from 子查询
    sql server 查询表某个字段不重复数据
    ASP.NET 获取来源网站的网址,获取上一网页的网址,获取来源网页的URL,获取上一网页的URL
    Warning: Invalid argument supplied for foreach()
    不支持关键字: “userid”。
    apache301重定向设置
    service httpd restart失败解决方法(小记)
    JavaWeb(一)
    jquery中filter的用法
  • 原文地址:https://www.cnblogs.com/123ing/p/3912117.html
Copyright © 2011-2022 走看看