Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- public class CustomWindow : EditorWindow {
- [MenuItem("Window/Test")]
- public static void Test() {
- EditorWindow.GetWindow<CustomWindow>("Test");
- }
- GameObject activeGO;
- Editor editor;
- void Update() {
- if (activeGO == Selection.activeGameObject)
- return;
- activeGO = Selection.activeGameObject;
- editor = null;
- if (activeGO != null)
- editor = UnityEditor.ActiveEditorTracker.MakeCustomEditor(activeGO.transform);
- Repaint();
- }
- void OnGUI() {
- GameObject go = Selection.activeGameObject;
- if (go == null)
- return;
- // Use the registered editor for `Transform`
- EditorGUILayout.InspectorTitlebar(true, editor.target);
- editor.OnInspectorGUI();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement