I’m working on a script that uses raycasting from the camera’s perspective to see what the player is looking at. Pretty standard stuff. The only question is, how to reliably find the camera?
Everything I’ve seen says you don’t want to use
Update() because performance, so instead you should call it once in
Start() and cache it in a field. And that’s great, as long as you can guarantee that the main camera will never change. But what if it does?
What I’d like is to have some sort of OnCameraUpdated event I can subscribe to that will let me know when the main camera has changed, but I don’t see anything like that on the
Camera class. Is there any good way to find this out without polling for it?