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

public class LeftRightTitleMove : MonoBehaviour
{
    public float dir, cpt;
    // Start is called before the first frame update
    void Start()
    {
        dir = 1f;
        GetComponent<RectTransform>().localPosition = Vector3.right * -4.5f;
    }

    // Update is called once per frame
    void Update()
    {
        cpt += Time.deltaTime;
        GetComponent<RectTransform>().localPosition += Vector3.right * dir * Time.deltaTime*3f;
        if(cpt > 3f)
        {
            dir = -dir;
            cpt = 0f;
        }
    }
}
