0
\$\begingroup\$

I've a GUI, and a panel with a Text control.

I simply want to do an automatic vertical scroll effect (circular).

Problems I've to solve: - How to identify if text on my textbox is "too much" and overflow vertical

  • How to move Text and not textbox transform Y

Can you help me find the correct solution ?

Thanks

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I solved:

  1. I put my text control inside a Panel

  2. I add a Rect Mask 2d to my panel

  3. I wrote this simple script to attach to Text control:

    [SerializeField] float              SecondsAfterStartAutoscroll;
    [SerializeField] float              ScrollSpeed;
    
    bool isScrolling = false;
    RectTransform rectTransf;
    
    void Start()
    {
    
        rectTransf = GetComponent<RectTransform>();        
        Invoke("EnableScroll", SecondsAfterStartAutoscroll);  
    }
    
    
    void EnableScroll()
    {
        isScrolling = true;
    }
    
    void Update()
    {
        if(isScrolling)
        {
            rectTransf.Translate(new Vector3(0, 1, 0) * Time.deltaTime * ScrollSpeed);
        }
    }
    

What I haven't solved yet: loop circular scroll... text didn't restart after last 'sentences' finish ..

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .