MapOffsetMove.cs 539 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MapOffsetMove : MonoBehaviour {
  5. public Vector2 speed = new Vector2(0.02f, 0.02f);
  6. private MeshRenderer m_Render = null;
  7. void Start () {
  8. m_Render = GetComponent<MeshRenderer>();
  9. // mRender.material.SetTextureScale("_MainTex", new Vector2(1, 1));
  10. }
  11. void Update () {
  12. m_Render.material.SetTextureOffset("_MainTex", new Vector2(1 + Time.time * speed.x, 1 + Time.time * speed.y));
  13. }
  14. }