Version: 2022.1
言語: 日本語

UnityEvent

class in UnityEngine.Events

/

継承:Events.UnityEventBase

マニュアルに切り替える

説明

A zero argument persistent callback that can be saved with the Scene.

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

public class ExampleClass : MonoBehaviour { UnityEvent m_MyEvent;

void Start() { if (m_MyEvent == null) m_MyEvent = new UnityEvent();

m_MyEvent.AddListener(Ping); }

void Update() { if (Input.anyKeyDown && m_MyEvent != null) { m_MyEvent.Invoke(); } }

void Ping() { Debug.Log("Ping"); } }

コンストラクタ

UnityEventコンストラクター

Public 関数

AddListenerUnityEvent に非永続的なリスナーを追加します
Invoke登録されているすべての(ランタイムと永続的な)コールバックを実行します
RemoveListenerRemove a non persistent listener from the UnityEvent. If you have added the same listener multiple times, this method will remove all occurrences of it.

継承メンバー

Public 関数

GetPersistentEventCount登録されている永続的なリスナーの数を取得します
GetPersistentListenerStateReturns the execution state of a persistent listener.
GetPersistentMethodNameインデックスから対象のリスナーのメソッド名を取得します
GetPersistentTargetインデックスから対象のリスナーのコンポーネントを取得します
RemoveAllListenersイベントからすべての非永続的な (つまり、スクリプトから作成された) リスナーを削除します
SetPersistentListenerState永続的なリスナーの実行状態を変更します

Static 関数

GetValidMethodInfoオブジェクト、メソッド名、引数の型のリストからマッチするメソッドを探します
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961