Create scrolling text in Unity

First create Image(note)

 

Create another Image below the note (as background)

In order to achieve the scrolling effect, add the Scroll Rect component to the Image

Also select objects (Content)

If you need to create a horizontal scroll bar, check Horizontal, otherwise, check Vertical

Then add text and adjust the text size according to your needs

Place the text under the Image as a sub-object. At the same time, in order to hide the redundant text, you need to add the Mask component to the Image (/* Pay attention to the order, first place the text under the Image, and then add the Mask component to the Image, otherwise text The text will disappear*/)

 

Also uncheck Show Mask Graphic to hide the background. (The following is a comparison picture, the previous one is checked, and the lower one is unchecked)

 

Start adding scroll bars and create a Scrollbar below the note.

 and adjust the position

At the same time, modify the properties of the Direction in the Scrollbar and choose according to your own needs.

Drag the scrollbar into the vertical scroll under the Scroll Rect of the Image (select horizontal and vertical according to your own needs)

Run, the example is as follows

March 9

Guess you like

Origin blog.csdn.net/xinyvhang/article/details/129432806