- Home /
 
               Question by 
               Absolly · Sep 20, 2014 at 05:57 PM · 
                c#cameramenu screenfieldofviewsplitscreen  
              
 
              How do i set fov for multiple cameras at once?
i am making a split screen game using Normalized Viewport Rectangle with two cameras and i want to make a slider in the options menu for fov but i can only change the fov for the top camera using Camera.main.fieldOfView and i can't find a way to change the other cameras' fov
my code:
 Camera.main.fieldOfView = GUILayout.HorizontalSlider(Camera.main.fieldOfView, 30.0F, 120.0F);
hope someone can help me
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by dmg0600 · Sep 20, 2014 at 06:06 PM
 Camera[] cameras;
 
 void YourMethod() {
     ...
     for (int i = 0; i < cameras.Length; ++i)
     {
         cameras[i].fieldOfView = GUILayout.HorizontalSlider(cameras[i].fieldOfView, 30.0F, 120.0F);
     }
     ...
 }
In the editor you have to drag your two cameras to the script array cameras.
thanks this worked great, only had to change Camera[] cameras; to be public. other than that it works great
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
object refer error 1 Answer
Maintain screenspace scale/position as camera field of view changes? 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                