【问题标题】:Infinite Vertical Scrolling in Unity3DUnity3D 中的无限垂直滚动
【发布时间】:2021-04-13 09:11:26
【问题描述】:

虽然我尝试使用垂直滚动背景,但垂直滚动时会出现补丁。

你能解释一下为什么吗?如果背景是水平滚动的,它工作正常!

可能是由于照明问题。

滚动脚本:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scrollscript : MonoBehaviour
{
    private float scrollSpeed = 0.2f;
    private Renderer rend;
    private Vector2 offset;

    // Start is called before the first frame update
    void Start() {
        rend = GetComponent<Renderer>();
    }

    // Update is called once per frame
    void Update() { 
        offset = new Vector2(0, Time.time * scrollSpeed);
        rend.material.mainTextureOffset = offset;
    }
}

【问题讨论】:

    标签: unity3d vertical-scrolling


    【解决方案1】:

    您需要创建图像以使其在水平和垂直方向上与其副本相匹配。 即应该创建图像的循环,以便当图像第二次滚动时,它不会被注意到。这是您需要在 Photoshop 或其他一些照片编辑软件中解决的问题,而不是 Unity。

    【讨论】:

      猜你喜欢
      • 2015-02-11
      • 2022-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-22
      相关资源
      最近更新 更多