Last active
October 31, 2019 10:02
-
-
Save Josef212/e63296f7b45260c57c8b6965d4e56380 to your computer and use it in GitHub Desktop.
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 UnityEngine.UI; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class EmptyGraphics : Graphic | |
{ | |
protected override void OnPopulateMesh(VertexHelper vh) | |
{ | |
vh.Clear(); | |
} | |
public override void SetMaterialDirty() { } | |
} | |
#if UNITY_EDITOR | |
[CustomEditor(typeof(EmptyGraphics))] | |
public class EmptyGraphicEditor : Editor | |
{ | |
private SerializedProperty m_scriptProp = null; | |
public override void OnEnable() | |
{ | |
m_scriptProp = serializedObject.FindProperty("m_Script"); | |
} | |
public override void OnInspectorGUI() | |
{ | |
// Default script field | |
GUI.enabled = false; | |
serializedObject.Update(); | |
EditorGUILayout.PropertyField(m_scriptProp); | |
serializedObject.ApplyModifiedProperties(); | |
GUI.enabled = true; | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment