ドキュメント

Unity Engine

Unity Engine

UnityEvent<T0, T1, T2>

Three argument version of UnityEvent.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

public class UnityEvent<T0, T1, T2> : UnityEventBase, ISerializationCallbackReceiver

Remarks

Generics are supported, specify type parameters on initialization as shown in the example. Refer to Configure callbacks in the Inspector for details on configuring callbacks in the Inspector window.
using UnityEngine;using UnityEngine.Events;public class ExampleClass : MonoBehaviour{ UnityEvent<int, int, int> m_MyEvent; void Start() { if (m_MyEvent == null) m_MyEvent = new UnityEvent<int, int, int>(); m_MyEvent.AddListener(DoSomething); } void Update() { if (Input.anyKeyDown && m_MyEvent != null) { m_MyEvent.Invoke(5, 6, 7); } } void DoSomething(int i, int j, int k) { Debug.Log("Callback called " + i + ", " + j + ", " + k); }}
Note: UnityEvent can also be awaited in any async method.

Inheritance