- Home /
 
               Question by 
               srancsik · Oct 29, 2013 at 03:17 PM · 
                camerascreenshotaspect ratio  
              
 
              SOLVED - Force camera to fixed aspect ratio and screenshot
Dear All,
I would like to ask for your help. I want to force a camera in C# to have the exact aspect ratio of an A4 size paper (297/210) and take a screenshot accordingly.
So far the code is as follows:
 Camera y = SCamera.GetComponent("Camera") as Camera;
 y.enabled=true;
 y.aspect=297/210; //SET ASPECT RATIO TO A4 SIZE
 Application.CaptureScreenshot("Screenshot.png",4);
In spite I set the camera aspect ratio, the taken screenshot is free aspect just as set in the Game view.
In advance I am thanking you for any help or hints.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by srancsik · Oct 30, 2013 at 09:31 AM
After browsing on the internet, I found a brilliant solution for this, works like a charm: http://gamedesigntheory.blogspot.ie/2010/09/controlling-aspect-ratio-in-unity.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                