Unity Camera Aspect

Source: Internet
Author: User

The camera's aspect is consistent with screen by default and can be set to the specified value by script, as follows:

Using Unityengine;
Using System.Collections;

public class Makecameraviewwequalsh:monobehaviour {

Use this for initialization
void Start () {
Gameobject.getcomponent<camera> (). aspect = 0.1f;
}

Update is called once per frame
void Update () {

}
}

At this point the camera's aspect is set to 1, except that the camera viewport shape changes even in the run-time editor. To see what Aspect=1 is, at present I know the method can only be the game viewport of the aspect ratio set to a temporary look at the correctness, confirm the correct later to adjust the game viewport aspect ratio recalled to the original value. While the viewport shape of the camera appears to be incorrect in the editor, the rendering is correct.

Unity Camera Aspect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.