Files
XCSDD/docs/api/resources/resourcemanager/load.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

33 lines
958 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.
# ResourceManager::Load
```cpp
template<typename T>
ResourceHandle<T> Load(const Containers::String& path, ImportSettings* settings = nullptr)
```
同步加载资源。模板方法,根据路径生成 GUID先在缓存中查找是否已加载若未加载则查找对应类型的加载器并同步加载然后将结果加入缓存。
**参数:**
- `path` - 资源路径
- `settings` - 导入设置(可选)
**返回:** `ResourceHandle<T>`,持有加载的资源
**复杂度:** O(n),取决于加载器实现
**示例:**
```cpp
ResourceHandle<Texture> tex = ResourceManager::Get().Load<Texture>("textures/player.png");
ResourceHandle<Mesh> mesh = ResourceManager::Get().Load<Mesh>("models/player.fbx");
ResourceHandle<Material> mat = ResourceManager::Get().Load<Material>("materials/player.mat");
if (tex.IsValid()) {
// 使用纹理...
}
```
## 相关文档
- [ResourceManager 总览](resourcemanager.md) - 返回类总览