Files
XCEngine/docs/api/XCEngine/Components/GameObject/GetChildCount.md

651 B

GameObject::GetChildCount

返回当前对象的直接子对象数量。

size_t GetChildCount() const;

行为说明

当前实现直接返回 m_children.size()

因此:

  • 统计的是“直接子对象”数量
  • 不包含孙节点或更深层子树
  • GetChild / GetChildren 共享同一份当前顺序

tests/Components/test_game_object.cpp 已验证在父对象挂入两个子对象后,这里会返回 2

返回值

  • size_t - 当前直接子对象数量。

相关文档