注意的地方:
贴图格式(Texture type): Texture
wrap Mode::Clamp
using UnityEngine;
using System.Collections;
public class BG : MonoBehaviour {
public float BGSpeed;//设置背景速度
private Material BGMaterial;
// Use this for initialization
void Start ()
{
//this.BGMaterial = renderer.material;//找到当前的材质
this.BGMateral = GetComponent<Renderer>().material;
}
// Update is called once per frame
void Update ()
{
//材质循环
this.BGMaterial.mainTextureOffset = new Vector2(BGSpeed*Time.time,0);
}
}