首页 > 代码库 > 2d背景循环

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));    }}

 

2d背景循环