Last active
December 15, 2015 15:39
-
-
Save anchan828/5283436 to your computer and use it in GitHub Desktop.
OnPreviewGUI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
[CustomEditor(typeof(HogeScript))] | |
public class CompactWindow : Editor | |
{ | |
private Editor model; | |
public override void OnInspectorGUI () | |
{ | |
HogeScript h = (HogeScript)target; | |
h.model = (GameObject)EditorGUILayout.ObjectField (h.model, typeof(GameObject), false); | |
if (h.model != null && model == null){ | |
model = Editor.CreateEditor (h.model); | |
} else { | |
model.OnPreviewGUI (GUILayoutUtility.GetRect (Screen.width, 256), EditorStyles.whiteLabel); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment