Material.mainTextureOffset 主纹理偏移量

var mainTextureOffset : Vector2

Description描述

The texture offset of the main texture.

主纹理中的纹理偏移量

The same as using GetTextureOffset or SetTextureOffset with "_MainTex" name.

这个与带有"_MainTex"名称的 GetTextureOffset SetTextureOffset 相同

参考:SetTextureOffset, GetTextureOffset.

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public float scrollSpeed = 0.5F;

	void Update() {

		float offset = Time.time * scrollSpeed;

		renderer.material.mainTextureOffset = new Vector2(offset, 0);

	}

}
// Scroll main texture based on time

//基于时间滚动主纹理



var scrollSpeed : float = 0.5;



function Update() {

	var offset : float = Time.time * scrollSpeed;

	renderer.material.mainTextureOffset = Vector2 (offset, 0);

}
Page last updated: 2011-1-21