Skip to content

Instantly share code, notes, and snippets.

@Josef212
Last active October 31, 2019 10:02
Show Gist options
  • Save Josef212/e63296f7b45260c57c8b6965d4e56380 to your computer and use it in GitHub Desktop.
Save Josef212/e63296f7b45260c57c8b6965d4e56380 to your computer and use it in GitHub Desktop.
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