how to generate a camera facing mesh with multiple cameras?

Hi! I’m attempting to render a camera facing laser beam (similar to a Line Render) It works great for a single camera, but naturally I run into issues with reflections.

Since it’s camera relative I need to adjust/recreate the mesh for each camera but I’m not sure how to do this elegantly. My first plan was to use DrawMesh then adjust and draw the mesh for each camera, but then I realised I don’t have a way for the laser object to know which cameras could be trying to render it.

I thought I could use OnPreRender and use Camera.current to be notified when a camera was attempting to render the laser (and which camera) but then I realised OnPreRender only gets called on the camera.

I could make the reflection script find any laser instances and call a function on the laser before it renders, but finding by type every frame seems wasteful. Ideally I’d like a method that doesn’t require the laser or the reflection system having to explicitly know about each other, in the same way particles and line renderers ‘just work’. Does anyone have any advice on how to approach this? I feel like there’s probably a more elegant solution that I’m missing…

Ah, I’ve figured it out.

OnWillRenderObject was what I needed. Hope that’s of use to anyone struggling with a similar problem!