2016年4月8日 星期五

背景移動

程式碼如下:

using UnityEngine;
using System.Collections;

public class starFieldScroll : MonoBehaviour
{
    public float scrollSpeed;//背景移動速度
    void Update () {
        GetComponent<Renderer>().material.mainTextureOffset = new  Vector2(0,Time.time * scrollSpeed);//背景移動;主纹理偏移(x軸不動,y軸移動(以秒為單位))
    }
}


沒有留言:

張貼留言

.htaccess應用

去除WWW RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.example\.com $ [ NC ] RewriteRule ^(.*) $ https: / /example.com/ $1 [ R = 301...