Created
January 27, 2019 08:02
-
-
Save neon-izm/c2f535fc64ea31b28042848e11accce1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var eventFireingSystem = target as EventFireringSystem; | |
//適当なエディタ拡張内を想定してほしい | |
if (GUILayout.Button("イベント登録!")) | |
{ | |
Debug.Log(path); | |
var go = GameObject.Find("Main Camera"); | |
//GameObjectを引数に取るUnityEditor上のインスペクタ上で設定するイベントハンドラ | |
UnityAction<GameObject> action = new UnityAction<GameObject>(eventFireingSystem.TestFunctionArgNeedGameObject); | |
UnityEventTools.AddObjectPersistentListener<GameObject>(eventFireingSystem.fireEvents, action, go); | |
//こういう書き方だと、インスペクタ上に出てこないのでダメ!! | |
/* | |
eventFireingSystem.fireEvents.AddListener(delegate { SwitchButtonHandler(0); }); | |
eventFireingSystem.fireEvents.Invoke(); | |
*/ | |
EditorUtility.SetDirty(eventFireingSystem); | |
//Persistent Event はシリアライズされたイベントのことです。 | |
//言い換えればエディタから登録されたイベントです | |
Debug.Log($"eventFireingSystem.fireEvents.{eventFireingSystem.fireEvents.GetPersistentEventCount()} "); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment