public override void OnInspectorGUI() { DrawDefaultInspector(); if (!EditorApplication.isPlaying) { return; } Dragon myScript = (Dragon)target; _amount = EditorGUILayout.IntField("Amount", _amount); if (GUILayout.Button("Bring Loot")) { myScript.BringBackLoot(_amount); Debug.Log("Brought back loot: " + _amount); } }