材质球图片的运动
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PaTiJianTou : MonoBehaviour {
[Range(0f, 1f)]
public float speed_x = 0;
[Range(0f, 1f)]
public float speed_y = 0;
private Material mater;
float x = 0;
float y = 0;
// Use this for initialization
void Start () {
mater = this.GetComponent<MeshRenderer>().material;
}
// Update is called once per frame
void Update () {
if (mater != null)
{
x += Time.deltaTime * speed_x;
y += Time.deltaTime * speed_y;
mater.SetTextureOffset("_MainTex", new Vector2(x, y));
}
}
}