Skip to content

Instantly share code, notes, and snippets.

@daltonbr
Created March 12, 2019 10:55
Show Gist options
  • Save daltonbr/7ad18c59862c568654609108ae1deb43 to your computer and use it in GitHub Desktop.
Save daltonbr/7ad18c59862c568654609108ae1deb43 to your computer and use it in GitHub Desktop.
A quick snippet of a Unity Custom Editor
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
[CustomEditor(typeof(Page))]
public class PageInspector : Editor {
public Material wordMat = null;
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUILayout.BeginVertical();
{
wordMat = EditorGUILayout.ObjectField(wordMat, typeof(Material), true ) as Material;
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
if( GUILayout.Button("Create Words") )
{
// create the text objects with the textures list.
CreatePage( target );
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("NOT IMPLEMENTED") )
{
// add the page image.
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
if(GUI.changed)
EditorUtility.SetDirty(target);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment