docs: expand gameobject helper docs
This commit is contained in:
@@ -1,31 +1,40 @@
|
||||
# GameObject::SetName
|
||||
|
||||
设置相关状态或配置。
|
||||
设置当前对象名称。
|
||||
|
||||
```cpp
|
||||
void SetName(const std::string& name);
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Components/GameObject.h`,当前页面用于固定 `GameObject` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:**
|
||||
- `name` - 参数语义详见头文件声明。
|
||||
|
||||
**返回:** `void` - 无返回值。
|
||||
|
||||
**示例:**
|
||||
当前实现就是一次直接赋值:
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/GameObject.h>
|
||||
|
||||
void Example() {
|
||||
XCEngine::Components::GameObject object;
|
||||
// 根据上下文补齐参数后调用 GameObject::SetName(...)。
|
||||
(void)object;
|
||||
}
|
||||
m_name = name;
|
||||
```
|
||||
|
||||
因此它不会自动做以下事情:
|
||||
|
||||
- 名称合法性校验
|
||||
- 重名去重
|
||||
- 空字符串回退
|
||||
- 级联修改 tag 或其他元数据
|
||||
|
||||
## 运行时影响
|
||||
|
||||
- 之后的 [GetName](GetName.md) 会立即返回新值
|
||||
- 若对象已注册到全局 registry,后续 [Find](Find.md) 也会按新名字参与匹配
|
||||
|
||||
## 参数
|
||||
|
||||
- `name` - 新对象名。
|
||||
|
||||
## 返回值
|
||||
|
||||
- 无。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](GameObject.md)
|
||||
- [返回模块目录](../Components.md)
|
||||
- [GetName](GetName.md)
|
||||
- [Find](Find.md)
|
||||
|
||||
Reference in New Issue
Block a user