2d背景循环

using UnityEngine;
using System.Collections;

/// <summary>
/// 2d背景循环滚动
/// </summary>
public class Test : MonoBehaviour
{
    public float xScrollSpeed=0.1f;
    public float yScrollSpeed=0f;
  
    void Update() {
        float offsetX = Time.time * xScrollSpeed;
        float offsetY = Time.time * yScrollSpeed;
        renderer.material.SetTextureOffset("_MainTex", new Vector2(offsetX, offsetY));
    }
}

 

posted @ 2014-11-11 10:42  ing...  阅读(141)  评论(0)    收藏  举报