docs: expand gameobject helper docs

This commit is contained in:
2026-04-03 16:11:48 +08:00
parent ee44e14960
commit 2c2e1fab1c
34 changed files with 597 additions and 603 deletions

View File

@@ -1,30 +1,28 @@
# GameObject::IsActiveInHierarchy
查询当前状态。
判断对象在当前父链下是否真正处于有效激活状态。
```cpp
bool IsActiveInHierarchy() const;
```
该方法声明于 `XCEngine/Components/GameObject.h`,当前页面用于固定 `GameObject` 类目录下的方法级 canonical 路径。
## 行为说明
**参数:** 无。
当前实现规则很直接:
**返回:** `bool` - 返回值语义详见头文件声明。
- 如果对象自己的 `m_activeSelf == false`,返回 `false`
- 否则若存在父对象,则递归询问父对象 `IsActiveInHierarchy()`
- 没有父对象时返回 `true`
**示例:**
因此它表达的是“这个对象现在是否真的处于运行层级里”,而不是“它自己有没有被勾选 active”。
```cpp
#include <XCEngine/Components/GameObject.h>
## 返回值
void Example() {
XCEngine::Components::GameObject object;
// 根据上下文补齐参数后调用 GameObject::IsActiveInHierarchy(...)。
(void)object;
}
```
- `true` - 对象自己激活,且所有父节点也都激活。
- `false` - 任一层不满足。
## 相关文档
- [返回类总览](GameObject.md)
- [返回模块目录](../Components.md)
- [IsActive](IsActive.md)
- [SetActive](SetActive.md)
- [SetParent](SetParent.md)