- Home /
camera.pixelrect not behaving properly
The following code
Camera.mainCamera.pixelRect = new Rect(0.5f,0,1,1);
Causes the pixelrect to be changed to x: 0.0004878049, y: 0, w: 0.0009756098, h: 0.001371742
Why do the actual values not match the programmed values?
Answer by MichaelTaylor3d · Nov 05, 2012 at 08:15 PM
Turns out that I was trying to set it as a Normalized like it is shown in the inspector. However when you set it through pixelrect it should not be normalized.
Answer by 3D-Magic-VR · Nov 05, 2012 at 08:02 PM
Hello there, instead of using "pixelRect" try with "rect", any doubt check the manual.
there is no option for that. I found out that even though the inspector shows the pixelrect as normalized. When you set it through code it should not be normalized.
Answer by nicloay · Sep 24, 2013 at 12:16 PM
Probably i faced similar problem, i updated pixelRect for one of my camera, but new value didn't change actual pixel rect of camera. before call camera i waited for end of frame. then i changed endOfFrame to waitForSecond(0.000001) (next frame) and new rect applied properly.
Your answer
Follow this Question
Related Questions
drawings secondary cameras in specifics places 1 Answer
Move the viewport, but maintain its size. 2 Answers
How to make camera position relative to a specific target. 1 Answer
How to destroy a projectile when it leaves any side of the camera view on a 2D game? 1 Answer
Orbit Camera around object 2 Answers