Skip to content
Base

基类 / Base

Base Class

GameObject和Script的基类,定义基础能力

Hierarchy

Table of contents

Properties

onPropertyChange: Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>>
监听系统属性同步事件

Methods

getPropertyChangeDelegate(property): Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> other
给定对象属性修改时触发的事件代理

Properties

onPropertyChange

onPropertyChange: Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>>

监听系统属性同步事件

ts
this.onPropertyChange.add((path, value, oldValue) => {
    console.log(`属性 ${path} 改变了,新值为 ${value},旧值为 ${oldValue}`);
});
this.onPropertyChange.add((path, value, oldValue) => {
    console.log(`属性 ${path} 改变了,新值为 ${value},旧值为 ${oldValue}`);
});

Methods

getPropertyChangeDelegate

getPropertyChangeDelegate(property): Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>> other

给定对象属性修改时触发的事件代理

Parameters

property string对象属性名字 例如:'x' 'rotation.x'

Returns

Readonly<MulticastDelegate<(path: string, value: unknown, oldValue: unknown) => void>>代理对象