Created
March 12, 2019 10:55
-
-
Save daltonbr/7ad18c59862c568654609108ae1deb43 to your computer and use it in GitHub Desktop.
A quick snippet of a Unity Custom Editor
This file contains 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; | |
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