Register all related EventTargets, all event callbacks will be removed in onPreDestroy protected _eventTargets: EventTarget[] = [];
The PrefabInfo object
which scene this node belongs to.
If true, the node is an persist node which won't be destroyed during scene transition.
If false, the node will be destroyed automatically when loading a new scene. Default is false.
The local active state of this node.
Note that a Node may be inactive because a parent is not active, even if this returns true.
Use activeInHierarchy
if you want to check if the Node is actually treated as active in the scene.
Indicates whether this node is active in the scene.
All children nodes.
Gets all components attached to this node.
Indicates whether the object is not yet destroyed. (It will not be available after being destroyed)
When an object's destroy
is called, it is actually destroyed after the end of this frame.
So isValid
will return false from the next frame, while isValid
in the current frame will still be true.
If you want to determine whether the current frame has called destroy
, use cc.isValid(obj, true)
,
but this is often caused by a particular logical requirements, which is not normally required.
Name of node.
which scene this node belongs to.
The uuid for editor, will be stripped before building project.
Clear all references in the instance.
NOTE: this method will not clear the getter or setter functions which defined in the instance of CCObject. You can override the _destruct method if you need, for example: _destruct: function () { for (var key in this) { if (this.hasOwnProperty(key)) { switch (typeof this[key]) { case 'string': this[key] = ''; break; case 'object': case 'function': this[key] = null; break; } } }
Adds a component class to the node. You can also add component to node by passing in the name of the script.
Adds a component class to the node. You can also add component to node by passing in the name of the script.
Properties configuration function
All properties in attrs will be set to the node,
when the setter of the node is available,
the property will be set via setter function.
Properties to be set to node
Destroy all children from the node, and release all their own references to other objects.
Actual destruct operation will delayed until before rendering.
Returns a child from the container given its name.
A name to find the child node.
a CCNode object whose name equals to the input parameter
Returns a child from the container given its path.
A path to find the child node.
a CCNode object whose name equals to the input parameter
Returns a child from the container given its uuid.
The uuid to find the child node.
a Node whose uuid equals to the input parameter
Returns the component of supplied type if the node has one attached, null if it doesn't.
You can also get component in the node by passing in the name of the script.
Returns the component of supplied type if the node has one attached, null if it doesn't.
You can also get component in the node by passing in the name of the script.
Returns the component of supplied type in any of its children using depth first search.
Returns the component of supplied type in any of its children using depth first search.
Returns all components of supplied type in the node.
Returns all components of supplied type in the node.
Returns all components of supplied type in self or any of its children.
Returns all components of supplied type in self or any of its children.
Get parent of the node.
Get the sibling index.
Inserts a child to the node at a specified index.
the child node to be inserted 要插入的子节点
the sibling index to place the child in 用于放置子节点的同级索引
invalidate the world transform information for this node and all its children recursively
Is this node a child of the given node?
True if this node is a child, deep child or identical to the given node.
Removes all children from the container.
Removes a child from the container.
The child node which will be removed. 将被移除的子节点
Removes a component identified by the given name or removes the component object given. You can also use component.destroy() if you already have the reference.
Removes a component identified by the given name or removes the component object given. You can also use component.destroy() if you already have the reference.
Remove itself from its parent node.
If the node orphan, then nothing happens.
父节点
是否保留当前世界变换
目标本地坐标
目标本地坐标的 X 分量
目标本地坐标的 Y 分量
目标本地坐标的 Z 分量
目标本地旋转
目标本地旋转的 X 分量
目标本地旋转的 Y 分量
目标本地旋转的 Z 分量
目标本地旋转的 W 分量
目标欧拉角的 X 分量
目标欧拉角的 Y 分量
目标欧拉角的 Z 分量
目标本地缩放
目标本地缩放的 X 分量
目标本地缩放的 Y 分量
目标本地缩放的 Z 分量
Set the sibling index of this node.
目标世界坐标
目标世界坐标的 X 分量
目标世界坐标的 Y 分量
目标世界坐标的 Z 分量
目标世界旋转
目标世界旋转的 X 分量
目标世界旋转的 Y 分量
目标世界旋转的 Z 分量
目标世界旋转的 W 分量
目标欧拉角的 X 分量
目标欧拉角的 Y 分量
目标欧拉角的 Z 分量
目标世界缩放
目标世界缩放的 X 分量
目标世界缩放的 Y 分量
目标世界缩放的 Z 分量
update the world transform information if outdated
Walk though the sub children tree of the current node. Each node, including the current node, in the sub tree will be visited two times, before all children and after all children. This function call is not recursive, it's based on stack. Please don't walk any other node inside the walk process.
The callback to process node when reach the node for the first time
The callback to process node when re-visit the node after walked all children in its sub tree
待测试的节点
Generated using TypeDoc
Class of private entities in Cocos Creator 3d scenes.
The PrivateNode is hidden in editor, and completely transparent to users.
It's normally used as Node's private content created by components in parent node.
So in theory private nodes are not children, they are part of the parent node.
Private node have two important characteristics:
In this way, they can be easily kept inside the bounding box.
Currently, it's used by RichText component and TileMap component.
PrivateNode
Node