Material.mainTextureScale 主纹理缩放

var mainTextureScale : Vector2

Description描述

The texture scale of the main texture.

主纹理中的纹理缩放量

The same as using GetTextureScale or SetTextureScale with "_MainTex" name.

这个和使用 "_MainTex" 名称的 GetTextureScale SetTextureScale 相同

参考:SetTextureScale , GetTextureScale .

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Update() {
		float scaleX = Mathf.Cos(Time.time) * 0.5F + 1;
		float scaleY = Mathf.Sin(Time.time) * 0.5F + 1;
		renderer.material.mainTextureScale = new Vector2(scaleX, scaleY);
	}
}
function Update () {
	// Animates main texture scale in a funky way!
	//以独特的方式动画主纹理的缩放!

	var scaleX : float = Mathf.Cos ( Time.time ) * 0.5 + 1;
	var scaleY : float = Mathf.Sin ( Time.time ) * 0.5 + 1;
	renderer.material.mainTextureScale = Vector2 (scaleX,scaleY);
}
Page last updated: 2011-1-21