标签:nal typeof 加载 point layout option ide base pre
Hidden Folder(start with .)
Standard Assets:第一批加载的文件
Editor:只在编辑下才能使用,
Plugins
Resources:原生资源
Editor Default Resources
Gizmos:Gizmos资源
StreamingAssets:自定义资源
自定义一个编辑器窗口界面
Unity的编辑器的UI操作都很难用,继承EditorWindow
在OnGUI中绘制UI,触发并显示出来
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class MyWindow : EditorWindow {
    string myString = "Hello World";
    bool groupEnabled;
    bool myBool = true;
    float myFloat = 1.23f;
    // Add menu item named"My Window" to the Window menu
    [MenuItem("Window/My Window")]
    public static void ShowWindow()
    {
        // Show existing window instance.If one doesn't exist,make one.
        EditorWindow.GetWindow(typeof(MyWindow));
    }
    // 每一帧都会触发
    private void OnGUI()
    {
        GUILayout.Label("Base Settings", EditorStyles.boldLabel);
        myString = EditorGUILayout.TextField("Text Field", myString);
        groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled);
        myBool = EditorGUILayout.Toggle("Toggle", myBool);
        myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3);
        EditorGUILayout.EndToggleGroup(); 
    }
}

自定义一个编辑器窗口界面
Unity的编辑器UI操作都很难用
继承EditorWindow在O你GUI中汇正UI触发并显示出来
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(LookAtPoint))]     // 对于LookAtPoint的Custom
public class LookAtPointEditor : Editor {
    void OnInspectorGUI()
    {
        LookAtPoint lp = target as LookAtPoint;
        lp.lookAtPoint = EditorGUILayout.Vector3Field("Look At Point", lp.lookAtPoint);
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
    private void OnSceneGUI()
    {
        LookAtPoint lp = target as LookAtPoint;
        lp.lookAtPoint = Handles.PositionHandle(lp.lookAtPoint, Quaternion.identity);   // 坐标系
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
}
标签:nal typeof 加载 point layout option ide base pre
原文地址:https://www.cnblogs.com/carious/p/10819294.html