制作循环2D图片,利用Material.mainTextureOffset和精灵图片的Wrap Mode=reaped,来造成循环效果。

【Unity3D】利用Material.mainTextureOffset,制作循环2D图片效果

【Unity3D】利用Material.mainTextureOffset,制作循环2D图片效果

public class ImageOffset : MonoBehaviour
{
    public Vector2 v;
    Material material;
    // Start is called before the first frame update
    void Start()
    {
        material = GetComponent<SpriteRenderer>().material;
    }

    // Update is called once per frame
    void Update()
    {
       
        material.mainTextureOffset = Time.time * v;
      
       
    }
}
 

相关文章:

  • 2022-01-01
  • 2021-09-25
  • 2021-05-10
  • 2021-06-23
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
相关资源
相似解决方案