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

33 lines
685 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.
# 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
```