Material材质 翻译:titan-志广
- color
- CopyPropertiesFromMaterial
- GetColor
- GetFloat
- GetMatrix
- GetTag
- GetTextureOffset
- GetTextureScale
- GetTexture
- GetVector
- HasProperty
- Lerp
- mainTextureOffset
- mainTextureScale
- mainTexture
- Material
- passCount
- renderQueue
- SetColor
- SetFloat
- SetMatrix
- SetPass
- SetTextureOffset
- SetTextureScale
- SetTexture
- SetVector
- shader
Material.SetTextureOffset 设置纹理偏移
function SetTextureOffset (propertyName : string, offset : Vector2) : void
Description描述
Sets the placement offset of texture propertyName.
设置纹理propertyName的偏移量。
Common texture names used by Unity's builtin shaders:
在unity着色器中使用的统一的纹理名称
"_MainTex" is the main diffuse texture .This can also be accessed via mainTextureOffset property.
"_MainTex"是主要的漫反射纹理,也能通过 mainTextureOffset 属性访问
"_BumpMap" is the normal map.
"_BumpMap"是法线贴图
"_Cube" is the reflection cubemap.
"_Cube"是反射cubemap.(立方体贴图)
参见: mainTextureOffset 属性, GetTextureOffset .
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float scrollSpeed = 0.5F;
void Update() {
float offset = Time.time * scrollSpeed;
renderer.material.SetTextureOffset("_MainTex", new Vector2(offset, 0));
}
}
最后修改:2011年1月22日 Saturday 21:00