ChuanXin 发表于 2022-11-29 13:56

unity EditorGUI绘制模型显示


image.png

using UnityEditor;using UnityEngine;/// <summary>/// GUI绘制模型显示/// </summary>public class GameObjectEditorWindow : EditorWindow{    GameObject gameObject;    Editor gameObjectEditor;        static void ShowWindow()    {      GetWindow<GameObjectEditorWindow>("GameObject Editor");    }    void OnGUI()    {      gameObject = (GameObject)EditorGUILayout.ObjectField(gameObject, typeof(GameObject), true);      if (gameObject != null)      {            if (gameObjectEditor == null)                gameObjectEditor = Editor.CreateEditor(gameObject);            gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(500, 500), EditorStyles.whiteLabel);      }    }}
页: [1]
查看完整版本: unity EditorGUI绘制模型显示