UnityEvent

class in UnityEngine.Events

/

Inherits from:Events.UnityEventBase

Switch to Manual

Description

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"); } }

Constructors

UnityEventКонструктор.

Public Functions

AddListenerAdd a non persistent listener to the UnityEvent.
InvokeАктивизирует все зарегистрированные ответные вызовы (работающие во время исполнения и временные).
RemoveListenerRemove a non persistent listener from the UnityEvent.

Inherited members

Public Functions

GetPersistentEventCountGet the number of registered persistent listeners.
GetPersistentMethodNameGet the target method name of the listener at index index.
GetPersistentTargetПолучает целевой компонент слушателя по индексу.
RemoveAllListenersRemove all non-persisent (ie created from script) listeners from the event.
SetPersistentListenerStateИзменяет состояние выполнения постоянного слушателя.

Static Functions

GetValidMethodInfoЗадан объект, имя функции и список типов аргументов; находит подходящий метод.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961