Graphics.DrawMeshInstanced draws meshes blinking

I am using Graphics.DrawMeshInstanced and it does not work for me meshes are blinking:
RipeLivelyHerculesbeetle

Graphics.DrawMeshInstanced(mesh, 0, playerMaterial, matrixList);

What can I do to fix that?

Hi!
Please submit a bug report.

Are you doing this in Update, FixedUpdate, LateUpdate?
Edit: maybe in a co-routine?

I have some bug in my shader. Will check if it is the case if not I will send a bug report.

I am using ECS in this project and it is done in OnUpdate

Is ECS supposed to be work with rendering?.

Why not? You have to render your content somehow. It was shader issue, I forgot to declare some variables but now it works very well. I can render like 150-200 characters and maintain 25-28 fps on Android (xiaomi redmi note 4), and most of the cost is from colliders because each NavMeshAgent has capsule collider.

1 Like

I am having the same issue, could you tell me when variables you declared or added that stopped it from blinking.

if anyone else googles this thread, it turns out there’s a bug with DrawMeshInstanced() in Unity 2021.x where instances will flicker / blink if you pass in a Camera parameter… won’t be fixed until Unity 2022.2 ??

work around: pass in “null” for Camera

3 Likes