有没有一种方法可以使用Graphics.DrawMeshInstancedIndirect并为所有内容绘制另一种颜色? 这是我的更新循环,在其中调用带有属性块的DrawMeshInstancedIndirect,但这会更改其绘制的所有内容。
void Update()
{
if (instanceCount > 0)
{
// Update starting position buffer
if (instanceCount <= instanceCap)
{
if (cachedInstanceCount != instanceCount)
{
SetBuffers();
}
else
{
UpdateBuffers();
}
}
// Render
Graphics.DrawMeshInstancedIndirect(instanceMesh, 0, instanceMaterial, new Bounds(mainCamera.transform.position, new Vector3(10.0f, 10.0f, 10.0f)), argsBuffer, 0, materialPropertyBlock);
for (int i = 0; i < UnitsList.Count; i++)
{
UnitsList[i].UpdateUnit();
}
}
}