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

958 B
Raw Blame History

ResourceManager::Load

template<typename T>
ResourceHandle<T> Load(const Containers::String& path, ImportSettings* settings = nullptr)

同步加载资源。模板方法,根据路径生成 GUID先在缓存中查找是否已加载若未加载则查找对应类型的加载器并同步加载然后将结果加入缓存。

参数:

  • path - 资源路径
  • settings - 导入设置(可选)

返回: ResourceHandle<T>,持有加载的资源

复杂度: O(n),取决于加载器实现

示例:

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()) {
    // 使用纹理...
}

相关文档