Files
XCEngine/docs/api/resources/resource-dependency-graph/decrement-ref-count.md

33 lines
685 B
Markdown
Raw Normal View History

2026-03-20 02:35:35 +08:00
# DecrementRefCount
减少资源的引用计数。
## 方法签名
```cpp
void DecrementRefCount(ResourceGUID guid);
```
## 详细描述
原子地减少指定资源的引用计数。引用计数不会减少到 0 以下。如果节点不存在或引用计数已为 0则不做任何操作。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `guid` | `ResourceGUID` | 目标资源的全局唯一标识符 |
## 返回值
## 示例
```cpp
graph.IncrementRefCount("texture"_guid);
graph.IncrementRefCount("texture"_guid);
graph.DecrementRefCount("texture"_guid); // refCount 现在为 1
graph.DecrementRefCount("texture"_guid); // refCount 现在为 0
```