-
-
Save gekidoslair/22b1795c42e64ac7e578f2624d615c02 to your computer and use it in GitHub Desktop.
Template for Custom Inspector Script in Unity3d
This file contains 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 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