unity
runtime_error
ai_generated
true
ArgumentException: CommandBuffer: 无效的 ComputeBuffer 名称(空或 null)
ArgumentException: CommandBuffer: Invalid ComputeBuffer name (null or empty)
ID: unity/rendering-command-buffer-invalid
96%修复率
90%置信度
1证据数
2024-07-30首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Unity 2022.3 | active | — | — | — |
| Unity 2023.2 | active | — | — | — |
| Unity 6000.0 | active | — | — | — |
根因分析
CommandBuffer.SetComputeBufferParam 调用使用了空或 null 字符串作为着色器属性名称。
English
A CommandBuffer.SetComputeBufferParam call was made with a null or empty string as the shader property name.
官方文档
https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.SetComputeBufferParam.html解决方案
-
Ensure the property name passed to SetComputeBufferParam matches the name in the compute shader's [numthreads] or buffer declaration.
-
Add a null check before calling SetComputeBufferParam to avoid passing empty strings.
无效尝试
常见但无效的做法:
-
95% 失败
The shader property name must be consistent between C# and the shader code; arbitrary names cause shader binding failures.
-
60% 失败
This workaround removes the functionality instead of fixing the root cause.