public override void OnInspectorGUI() { // set the component target that the additional GUI elements will appear to SampleCustomComponent targetComponent = (SampleCustomComponent)target; // draws the default Inspector items DrawDefaultInspector(); if (GUILayout.Button("Test")) { //targetComponent.MyMethod(); // call a "MyMethod()" from targetComponent Debug.Log("Button Clicked..."); } }
public override void OnInspectorGUI() { // set the component target that the additional GUI elements will appear to SampleCustomComponent targetComponent = (SampleCustomComponent)target; // draws the default Inspector items DrawDefaultInspector(); // like DrawDefaultInspector() but doesn't draw the elements you tell it to // DrawPropertiesExcluding(serializedObject, "m_Script"); if (GUILayout.Button("Test")) { //targetComponent.MyMethod(); // call a "MyMethod()" from targetComponent Debug.Log("Button Clicked..."); } }