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

スクリプト言語

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

Material.mainTexture

public var mainTexture: Texture;

Description

マテリアルのテクスチャ

これは GetTexture"_MainTex" を使用しての SetTexture と同じ動作をします。 See Also: SetTexture, GetTexture.

	// Assign the texture exposed in the inspector the renderer's material

	var texture : Texture;
	renderer.material.mainTexture = texture;

他の例:

	// Change renderer's texture each changeInterval/
	// seconds from the texture array defined in the inspector.

	var textures : Texture[];
	var changeInterval : float = 0.33;

	function Update() {
		if( textures.length == 0 ) // nothing if no textures
			return;

		// we want this texture index now
		var index : int = Time.time / changeInterval;
		// take a modulo with size so that animation repeats
		index = index % textures.length;
		// assign it
		renderer.material.mainTexture = textures[index];
	}