24 lines
548 B
C#
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;
|
|
}
|
|
}
|