Skip to content

Instantly share code, notes, and snippets.

@keiranlovett
Forked from bzgeb/TriggerEditor.cs
Created February 4, 2014 10:59
Show Gist options
  • Save keiranlovett/8801646 to your computer and use it in GitHub Desktop.
Save keiranlovett/8801646 to your computer and use it in GitHub Desktop.
using UnityEngine;
using UnityEditor;
[CustomEditor (typeof(Trigger))]
[CanEditMultipleObjects()]
public class TriggerEditor : Editor
{
private SerializedObject obj;
private SerializedProperty radius;
public void OnEnable()
{
obj = new SerializedObject(target);
radius = obj.FindProperty("radius");
}
public override void OnInspectorGUI()
{
obj.Update();
GUIStyle style = new GUIStyle();
style.font = EditorStyles.boldFont;
EditorGUILayout.LabelField("Trigger", style, null);
EditorGUILayout.PropertyField(radius);
obj.ApplyModifiedProperties();
}
public void OnSceneGUI()
{
// Implement what you want to see in scene view here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment