Multiple Camera.main.ScreenPointToRay

I am raycasting for collision objects using the command


This works fine when I am using only one camera with the CameraMain tag. How do I continue to use screen raycasting when I have several cameras that are being switched in the scene?

Camera.main can only refer to one camera(*) Unity will grab the first camera it finds with that tag. Use a different way of referencing them than Camera.main. An array is probably a good bet.

(*) One active camera. But I assume you can't disable the other cameras, if you haven't had luck with that loophole yet.