Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

custom editor unity

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(MyComponent))]
[CanEditMultipleObjects]
public class MyComponentEditor : Editor 
{    
    public override void OnInspectorGUI()
    {
        MyComponent myComponent = (MyComponent)target;
        
        DrawDefaultInspector();
        
        if(GUILayout.Button("MyButton"))
        {
        	myComponent.doSomething();
        }
    }
}
 
PREVIOUS NEXT
Tagged: #custom #editor #unity
ADD COMMENT
Topic
Name
6+2 =