Skip to content

Instantly share code, notes, and snippets.

@anchan828
Last active December 15, 2015 15:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anchan828/5283436 to your computer and use it in GitHub Desktop.
Save anchan828/5283436 to your computer and use it in GitHub Desktop.
OnPreviewGUI
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