Version: 2020.2
LanguageEnglish
  • C#

CommandBuffer.SetInstanceMultiplier

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public void SetInstanceMultiplier(uint multiplier);

Description

Adds a command to multiply the instance count of every draw call by a specific multiplier.

Changing the instance multiplier is useful for stereo rendering optimizations such as single pass instanced rendering. For example, if you set the multiplier to 2, a command that draws one instance, instead draws two, and a command that draws two instances, draws four. See Single Pass Instanced Rendering for more information.

The multiplier is used until you reset it by calling this function again with a new value. The default multiplier is 1. Passing a parameter value of 0 to this function also sets the instance multiplier to 1.

The instance multiplier affects draw calls submitted by internal Unity Engine functions as well as CommandBuffer.DrawMesh, CommandBuffer.DrawMeshInstanced, Graphics.DrawMeshInstanced, CommandBuffer.DrawProcedural, and Graphics.DrawProcedural

Note that the multiplier is not used for the indirect commands, CommandBuffer.DrawMeshInstancedIndirect, Graphics.DrawMeshInstancedIndirect, CommandBuffer.DrawProceduralIndirect, Graphics.DrawProceduralIndirect.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961