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

41 lines
622 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# GameObject::SetName
设置当前对象名称。
```cpp
void SetName(const std::string& name);
```
## 行为说明
当前实现就是一次直接赋值:
```cpp
m_name = name;
```
因此它不会自动做以下事情:
- 名称合法性校验
- 重名去重
- 空字符串回退
- 级联修改 tag 或其他元数据
## 运行时影响
- 之后的 [GetName](GetName.md) 会立即返回新值
- 若对象已注册到全局 registry后续 [Find](Find.md) 也会按新名字参与匹配
## 参数
- `name` - 新对象名。
## 返回值
- 无。
## 相关文档
- [GetName](GetName.md)
- [Find](Find.md)