unity runtime_error ai_generated true

ArgumentException: CommandBuffer: 无效的 ComputeBuffer 名称(空或 null)

ArgumentException: CommandBuffer: Invalid ComputeBuffer name (null or empty)

ID: unity/rendering-command-buffer-invalid

其他格式: JSON · Markdown 中文 · English
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.

generic

官方文档

https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.SetComputeBufferParam.html

解决方案

  1. Ensure the property name passed to SetComputeBufferParam matches the name in the compute shader's [numthreads] or buffer declaration.
  2. Add a null check before calling SetComputeBufferParam to avoid passing empty strings.

无效尝试

常见但无效的做法:

  1. 95% 失败

    The shader property name must be consistent between C# and the shader code; arbitrary names cause shader binding failures.

  2. 60% 失败

    This workaround removes the functionality instead of fixing the root cause.