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

スクリプト言語

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

GUI.DrawTexture

public static function DrawTexture(position: Rect, image: Texture, scaleMode: ScaleMode = ScaleMode.StretchToFill, alphaBlend: bool = true, imageAspect: float = 0): void;

Parameters

position テクスチャを描画するスクリーン上のRect
image 表示するTexture
scaleMode 描画されるものでアスペクト比が合わないときに画像をどのようにスケーリングするか
alphaBlend 画像を描画するときアルファブレンディングを適用するかどうか(デフォルトはtrue)
imageAspect ソース画像で使用するアスペクト比。もし0(デフォルト)である場合、画像のアスペクト比を使用します。望ましいアスペクト比は「幅/高さ」になります。これは、ソース画像の幅と高さを変更することなくアスペクト比を調整することができます

Description

Rect内部にテクスチャを描画します

	// Draws a texture in the left corner of the screen.
	// The texture is drawn in a window 60x60 pixels.
	// The source texture is given an aspect ratio of 10x1
	// and scaled to fit in the 60x60 rectangle.  Because
	// the aspect ratio is preserved, the texture will fit
	// inside a 60x10 pixel area of the screen rectangle.
	var aTexture : Texture;

	function OnGUI() {
		if(!aTexture){
			Debug.LogError("Assign a Texture in the inspector.");
			return;
		}
		GUI.DrawTexture(Rect(10,10,60,60), aTexture, ScaleMode.ScaleToFit, true, 10.0f);
	}