OnWillRenderObject without renderer?

Hi,

I want to write code to basically implement my own renderer :

void OnWillRenderObject()
{
    //Logic with Camera.current
    Graphics.DrawMesh(....)
}

However, if I don't have a renderer attached to the GameObject, I don't get the call. Does anyone know of a way to do logics such as these?

Found this one as well, but with another purpose. Adding an empty mesh renderer didn't seem to help.

1 Answer

1

OnWillRenderObject will not be called on your empty MeshRenderer, because, being empty, the mesh won’t pass through culling. The best place to implement such custom rendering logic is probably Camera.OnRenderObject().