Options
All
  • Public
  • Public/Protected
  • All
Menu

Module data

Index

References

CCBoolean

Re-exports CCBoolean

CCFloat

Re-exports CCFloat

CCInteger

Re-exports CCInteger

CCObject

Re-exports CCObject

CCString

Re-exports CCString

CompactValueTypeArray

Re-exports CompactValueTypeArray

instantiate

Re-exports instantiate

isValid

Re-exports isValid

Type aliases

CustomInstantiation

CustomInstantiation: <T>(this: T, instantiated?: T) => T

Invoke _instantiate method if supplied. The _instantiate callback will be called only on the root object, its associated object will not be called.

param

If supplied, _instantiate just need to initialize the instantiated object, no need to create new object by itself.

returns

The instantiated object.

Type declaration

    • <T>(this: T, instantiated?: T): T
    • Type parameters

      • T

      Parameters

      • this: T
      • Optional instantiated: T

      Returns T

Variables

Const Deactivating

Deactivating: number = 1 << 8

Const Destroyed

Destroyed: number = 1 << 0

Const Destroyed

Destroyed: Flags = CCObject.Flags.Destroyed

Const Destroying

Destroying: number = 1 << 7

Const Dirty

Dirty: number = 1 << 5

Const DontDestroy

DontDestroy: number = 1 << 6

Const DontSave

DontSave: number = 1 << 3

Const EditorOnly

EditorOnly: number = 1 << 4

Const HideInHierarchy

HideInHierarchy: number = 1 << 10

Const IsAnchorLocked

IsAnchorLocked: number = 1 << 19

Const IsEditorOnEnableCalled

IsEditorOnEnableCalled: number = 1 << 12

Const IsOnEnableCalled

IsOnEnableCalled: number = 1 << 11

Const IsOnLoadCalled

IsOnLoadCalled: number = 1 << 14

Const IsOnLoadStarted

IsOnLoadStarted: number = 1 << 15

Const IsPositionLocked

IsPositionLocked: number = 1 << 21

Const IsPreloadStarted

IsPreloadStarted: number = 1 << 13

Const IsRotationLocked

IsRotationLocked: number = 1 << 17

Const IsScaleLocked

IsScaleLocked: number = 1 << 18

Const IsSizeLocked

IsSizeLocked: number = 1 << 20

Const IsStartCalled

IsStartCalled: number = 1 << 16

Const LockedInEditor

LockedInEditor: number = 1 << 9

Const PersistentMask

PersistentMask: number = ~(ToDestroy | Dirty | Destroying | DontDestroy | Deactivating| IsPreloadStarted | IsOnLoadStarted | IsOnLoadCalled | IsStartCalled| IsOnEnableCalled | IsEditorOnEnableCalled| IsRotationLocked | IsScaleLocked | IsAnchorLocked | IsSizeLocked | IsPositionLocked/* RegisteredInEditor */)

Const PersistentMask

PersistentMask: Flags = CCObject.Flags.PersistentMask

Const RealDestroyed

RealDestroyed: number = 1 << 1

Const ToDestroy

ToDestroy: number = 1 << 2

Let deferredDestroyTimer

deferredDestroyTimer: null = null

Const objectsToDestroy

objectsToDestroy: any = []

Const objsToClearTmpVar

objsToClearTmpVar: any = []

Const prototype

prototype: CCObject = CCObject.prototype

Functions

compileDestruct

  • compileDestruct(obj: any, ctor: any): Function

doInstantiate

  • doInstantiate(obj: any, parent?: any): any

enumerateCCClass

  • enumerateCCClass(klass: any, obj: any, clone: any, parent: any): void

enumerateObject

  • enumerateObject(obj: any, clone: any, parent: any): void

instantiate

  • instantiate(prefab: Prefab): Node
  • instantiate<T>(original: T): T
  • 从 Prefab 实例化出新节点。

    example
    import { instantiate, director } from 'cc';
    // Instantiate node from prefab.
    const node = instantiate(prefabAsset);
    node.parent = director.getScene();

    Parameters

    Returns Node

    The instantiated node.

  • en

    Clones the object `original.

    zh

    克隆指定的任意类型的对象。

    example
    import { instantiate, director } from 'cc';
    // Clone a node.
    const node = instantiate(targetNode);
    node.parent = director.getScene();

    Type parameters

    • T

    Parameters

    • original: T

      An existing object that you want to make a copy of. It can be any JavaScript object(typeof original === 'object') but:

      • it shall not be array or null;
      • it shall not be object of Asset;
      • if it's an object of CCObject, it should not have been destroyed.

    Returns T

    The newly instantiated object.

instantiateObj

  • instantiateObj(obj: any, parent: any): any

isValid

  • isValid(value: any, strictMode?: undefined | false | true): boolean

Generated using TypeDoc