27 lines
651 B
C#
27 lines
651 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class infinityUI : MonoBehaviour
|
|
{
|
|
public float speed;
|
|
public RectTransform panel;
|
|
public Vector2 curPosition;
|
|
public Vector2 curSize;
|
|
|
|
private void Start()
|
|
{
|
|
panel.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, Screen.width * 2);
|
|
}
|
|
public float curX;
|
|
void FixedUpdate()
|
|
{
|
|
curX += Time.deltaTime * speed;
|
|
curPosition = panel.localPosition;
|
|
curSize = panel.sizeDelta;
|
|
|
|
if(curX >= Screen.width) { curX = 0; }
|
|
panel.anchoredPosition = new Vector2(-curX, 0);
|
|
}
|
|
}
|