My game has 2 cameras.
I'm instancing a bunch of grass and I want the second camera to not render the grass. How can I do this?
The grass is instanced via DrawMeshInstancedIndirect.
CodePudding user response:
DrawMeshInstancedIndirect
has an argument "camera", its description is:
If null (default), the mesh will be drawn in all cameras. Otherwise it will be drawn in the given Camera only.
To draw meshes in a specific camera, just pass this camera instance to the method.
Camera cameraToDraw;
Graphics.DrawMeshInstancedIndirect(
mesh,
submeshIndex,
material,
bounds,
buffer,
camera: cameraToDraw);