Skip to content

Instantly share code, notes, and snippets.

@JohannesDeml
Created December 6, 2016 08:34
Show Gist options
  • Save JohannesDeml/bf72f439355f59dabe2ef27ee5182cd4 to your computer and use it in GitHub Desktop.
Save JohannesDeml/bf72f439355f59dabe2ef27ee5182cd4 to your computer and use it in GitHub Desktop.
Unity Custom inspector template
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="#SCRIPTNAME#.cs" company="Supyrb">
// Copyright (c) #YEAR# Supyrb. All rights reserved.
// </copyright>
// <author>
// Johannes Deml
// send@johannesdeml.com
// </author>
// --------------------------------------------------------------------------------------------------------------------
namespace Supyrb
{
using UnityEditor;
using UnityEngine;
//[CustomEditor(typeof(...))]
[CanEditMultipleObjects]
public class #SCRIPTNAME# : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
// Show "Script" at the top
EditorGUI.BeginDisabledGroup(true);
SerializedProperty prop = serializedObject.FindProperty("m_Script");
EditorGUILayout.PropertyField(prop, true, new GUILayoutOption[0]);
EditorGUI.EndDisabledGroup();
serializedObject.ApplyModifiedProperties();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment