HKI Core
GameEventEditor.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using UnityEditor;
3 
4 namespace HKI.Core.GameEvents.Editor
5 {
9  [CustomEditor(typeof(GameEvent))]
10  public class GameEventEditor : UnityEditor.Editor
11  {
12  // Variables
13  const float raiseButtonHeight = 50.0f;
14 
15  GameEvent gameEvent = null;
16 
17  // OnEnable function
18  void OnEnable()
19  {
20  gameEvent = (GameEvent)target;
21  }
22 
23  // OnInspectorGUI function
24  public override void OnInspectorGUI()
25  {
26  if(GUILayout.Button("Raise", GUILayout.Height(raiseButtonHeight)))
27  gameEvent.Raise();
28  }
29  }
30 }
void Raise()
Calling this function will inform all registered listener that this event is raised.
Definition: GameEvent.cs:24
Custom inspector for the GameEvent class. A button that allows the raising of an event in the editor...
This is a ScriptableObject game event. It can be listen too and raised via code or within Unity Edito...
Definition: GameEvent.cs:12