chip-gameV3/Assets/Scripts/Captions.cs
2026-07-14 11:14:13 +03:00

24 lines
548 B
C#

using UnityEngine;
public class Captions : MonoBehaviour
{
[SerializeField] RectTransform label;
[SerializeField] float speed = 10;
Vector2 startPosition = new Vector2(180, -709);
Vector2 endPosition = new Vector2(180, 3000);
private void OnEnable()
{
label.anchoredPosition = startPosition;
}
void Update()
{
label.anchoredPosition += Vector2.up * Time.deltaTime * speed;
if (label.anchoredPosition.y > endPosition.y)
label.anchoredPosition = startPosition;
}
}