Added lots of examples for editor customization
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94ea6f71efde4bd4ae34bde539c2c68c
|
||||
timeCreated: 1782225959
|
||||
@@ -0,0 +1,21 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Events.Editor
|
||||
{
|
||||
[CustomEditor(typeof(EventBroker))]
|
||||
public class EventBrokerEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (!EditorApplication.isPlaying) return;
|
||||
|
||||
if (GUILayout.Button("Player Died"))
|
||||
{
|
||||
(target as EventBroker)?.RaisePlayerDied();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea036d9930184985a5a989eeb914e5fe
|
||||
timeCreated: 1782226034
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Events
|
||||
{
|
||||
[CreateAssetMenu(fileName = "EventBroker", menuName = "Events/Event Broker")]
|
||||
public class EventBroker : ScriptableObject
|
||||
{
|
||||
public event Action PlayerDied;
|
||||
|
||||
public void RaisePlayerDied() => PlayerDied?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c8e9a4f877141c4b1f3e248fcef8803
|
||||
timeCreated: 1782225093
|
||||
Reference in New Issue
Block a user