Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.