Files
XCSDD/docs/api/resources/resourcehandle/reset.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

758 B

ResourceHandle::Reset

void Reset()

释放当前持有的资源引用。如果内部持有的资源指针非空,则调用 ResourceManager::Release() 减少引用计数,并将内部指针置为 nullptr。析构函数会自动调用此方法。

参数:

返回:

复杂度: O(1)

示例:

ResourceHandle<Texture> tex = ResourceManager::Get().Load<Texture>("tex.png");
// 使用纹理...
tex.Reset();  // 释放引用,引用计数 -1

// 或者让句柄离开作用域自动释放
{
    ResourceHandle<Mesh> mesh = ResourceManager::Get().Load<Mesh>("model.fbx");
    // 使用网格...
}  // mesh 自动 Reset()

相关文档