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,27 @@
# GameObject::GetParent
获取相关状态或对象。
返回当前对象的直接父对象。
```cpp
GameObject* GetParent() const;
```
该方法声明于 `XCEngine/Components/GameObject.h`,当前页面用于固定 `GameObject` 类目录下的方法级 canonical 路径。
## 行为说明
**参数:**
当前实现直接返回底层 `m_parent`
**返回:** `GameObject*` - 返回值语义详见头文件声明。
因此:
**示例:**
- 有父节点时返回对应直接父对象
- 根对象或独立对象返回 `nullptr`
- 不会递归查更高祖先
```cpp
#include <XCEngine/Components/GameObject.h>
## 返回值
void Example() {
XCEngine::Components::GameObject object;
// 根据上下文补齐参数后调用 GameObject::GetParent(...)。
(void)object;
}
```
- `GameObject*` - 当前直接父对象;没有父节点时返回 `nullptr`
## 相关文档
- [返回类总览](GameObject.md)
- [返回模块目录](../Components.md)
- [SetParent](SetParent.md)
- [DetachFromParent](DetachFromParent.md)
- [GetScene](GetScene.md)