Skip to content

Instantly share code, notes, and snippets.

@mrwellmann
Last active November 30, 2023 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrwellmann/c7ed1340f27bff4cd4ce78c304de3b60 to your computer and use it in GitHub Desktop.
Save mrwellmann/c7ed1340f27bff4cd4ce78c304de3b60 to your computer and use it in GitHub Desktop.
Draw Script Fields to the Script and EditorScript of a Unity UGUI Editor Extension
private void DrawScriptFields()
{
EditorGUI.BeginDisabledGroup(true);
MonoScript monoScript = (target as MonoBehaviour) != null
? MonoScript.FromMonoBehaviour((MonoBehaviour)target)
: MonoScript.FromScriptableObject((ScriptableObject)target);
EditorGUILayout.ObjectField("Script", monoScript, GetType(), false);
MonoScript monoScript2 = MonoScript.FromScriptableObject((ScriptableObject)this);
EditorGUILayout.ObjectField("EditorScript", monoScript2, GetType(), false);
EditorGUI.EndDisabledGroup();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment