using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; [CustomEditor(typeof(SoundPlayer))] public class SoundPlayerEditor : Editor { public override void OnInspectorGUI() { DrawDefaultInspector(); SoundPlayer script = target as SoundPlayer; if (GUILayout.Button($"PLAY")) { script.Play(); } } }