Graphics.DrawMesh in Prefab Stage

Is there a way to make Graphics.DrawMesh render something in Prefab Stage? It works fine in editor but not in Prefab Stage.

ExecuteAlways is set and Update method is being called, just doesn’t render anything.

I don’t think so. Generally all runtime APIs affect the main stage since Unity has no way of knowing that the method call comes from a Prefab stage. Except if the method call is on a component; then we can check which GameObject the component is on and whether that is in a Prefab stage; but for a static method like DrawMesh there’s no way.

It would be nice if there was a way to pass stage to DrawMesh or get the prefab stage camera to pass it to DrawMesh.

And is it possible to create a utility MeshRenderer in a prefab stage and make sure that it doesn’t get saved into prefab (HideAndDontSave or something)?

Ah, the Prefab Stage camera is just the Scene view camera. You could try and get that with

and pass it to the method. But I don’t know off the top of my head if it works or is still explicitly filtered away.

HideAndDontSave should prevent objects being saved to the Prefab asset

Thank you for your reply.

SceneView.camera works only partially and is not usable for my case.
HideAndDontSave works almost perfectly but the MeshRenderer, created in such way is still shown in the components list, though it is greyed out.