1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | using System.Collections; using System.Collections.Generic; using UnityEngine; public class textureOffset : MonoBehaviour { public float verticalSpeed; public float horizontalSpeed; Renderer rend; void Start() { rend = GetComponent<Renderer>(); } void Update() { float vOffset = Time.time * verticalSpeed; float hOffset = Time.time * horizontalSpeed; rend.material.mainTextureOffset = new Vector2(vOffset, hOffset); } } | cs |
'programming > c#' 카테고리의 다른 글
유니티 colorPulse (0) | 2020.02.19 |
---|---|
유니티 line renderer로 그리드 생성 (0) | 2020.02.15 |
유니티 객체 생성하기 (Instantiate) (0) | 2020.02.02 |
유니티 Physics - 움직임의 jitter를 줄이는 방법 (0) | 2020.01.04 |
GPU Instancing 최적화! 최적화! (1) | 2020.01.01 |