Cameras - Update But Do Not Render?

How can I prevent a camera from rendering, but still have it update as normal in other respects?

what do you mean?
1 you can remove camera component and add it again.
2 you can disable the camera component and enable it again

what properties do you want to be updated?

I mean that I want the camera’s Update event to be called, I want to be able to rotate and position the camera, and have all the relevant matrices, planes, etc update when I do. I want to be able to raycast from the camera. I want to be able to tell what objects are in the camera’s frustum. Essentially, all the things you would normally be able to do with a camera, I still want all that happening. I just don’t want to render anything.

Would it be better to set the camera’s culling mask to “nothing”?

whats the point of having a camera that does nothing?
Just don’t use it, take a monobehaviour and use all the rays etc from there.
there is no requirement to have a cam to have all those things.

It doesn’t do nothing. It does lots of things, or I wouldn’t be asking how to make it do them all. It just doesn’t always render.

Yes, I could raycast from a MonoBehaviour, but cameras can give me the raycast vector through the mouse position. I’m sure I could have my MonoBehaviour store a projection matrix, take the mouse position and do all that calculation myself, but why would I when a camera already does it all for me?

The camera doesn’t do anything that you can’t get access to via Camera functions (that I know of).

I really recommend doing non-Camera calculations in your own script. Trying to hack it to make a Camera update when it’s not rendering seems like the much worse option. Plus, a Camera should just be a camera. Simple create a new MonoBehaviour script and add it to your Camera’s GameObject.

With that said, maybe you could call the Camera’s Update() yourself via a SendMessage() from a script component added to the camera’s GameObject. Just make sure it’s not rendering so you don’t call it twice. I can’t say I’d recommend this approach but it may work!

Any component does that. The Script Reference of Input and Camera should really give you all you need there cause those two things will be used on a camera too, the camera object as such does not offer you anything at all other than rendering into a specific rect or texture, thats it. It does nothing but that

The Update call was just an example, and in retrospect, a bad one, because you’ve correctly pointed out that it’s not vital to me. However, objects entering and exiting the view frustum are vital to me. If I do as you suggest, will I still be getting those callbacks when something enters and/or exits the view frustum of the camera?

So why is ProjectionMatrix shown under the documentation for Camera but not for GameObject? And if GameObject doesn’t have a projection matrix, how can it possibly calculate something which relies upon said projection matrix?

That would do what you want here, yes. You might also need to change the clearFlags, depending on what you are doing.

Thanks andeeee. That seems to work fine.