Files
XCEngine/docs/api/XCEngine/Scene/SceneManager/GetScene.md

30 lines
647 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.
# SceneManager::GetScene
按内部 key 获取场景。
```cpp
Scene* GetScene(const std::string& name) const;
```
## 行为说明
当前实现直接用 `name``m_scenes` 里做哈希表查找。
## 参数
- `name` - 场景 key。
## 返回值
- `Scene*` - 找到时返回场景指针;找不到时返回 `nullptr`
## 注意事项
- 这个 `name` 对于 [CreateScene](CreateScene.md) 来说是创建时传入的名称。
- 对于 [LoadScene](LoadScene.md) 来说,它是文件名 stem而不一定等于场景内部的 `Scene::GetName()`
## 相关文档
- [返回类型总览](SceneManager.md)
- [LoadScene](LoadScene.md)