言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Camera.aspect

Switch to Manual
public float aspect;

Description

The aspect ratio (width divided by height).

By default the aspect ratio is automatically calculated from the screen's aspect ratio, even if the camera is not rendering to full area. If you modify the aspect ratio of the camera, the value will stay until you call camera.ResetAspect(); which resets the aspect to the screen's aspect ratio. See Also: camera component, Screen class.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        if (camera.aspect > 1.0F)
            print("Screen is more wide than tall!");
        else
            print("Screen is more tall than wide!");
    }
}