Demand
in the daily game, the text scrolling effect is more commonly used. For example, the daily game at the top of the news bulletin, chat system text scrolling, all belong to this range.
Ideas
because of the wide use of the place, so want to be able to play as independent as possible outside the game, can be used anywhere function. Text display belongs to the UI category, it is more appropriate to use the GUI function directly in Unity3d.
Realize
first, the news bulletin class
News bulletins The text scrolling is generally left-to-right, or down-to-top scrolling, and is mostly single-row single-column mode.
Public classLamp:monobehaviour { Public floatScrollviewwidth; Public floatScrollviewheight; Public floatMovespeed; PublicGuiskin Guiskin; Private floatTextpositionx =10f; voidOngui () {Gui.skin=Guiskin; floatScrollviewpositionx = (screen.width-scrollviewwidth)/2;//Center//start RollingGui. Beginscrollview (NewRect (Scrollviewpositionx,Ten, Scrollviewwidth, Scrollviewheight), Vector2.zero,NewRect (Ten,Ten, Scrollviewwidth, scrollviewheight)); Gui. Label (NewRect (Textpositionx,Ten,770, +),"Roll It! Uncle!! "); Textpositionx+ = time.deltatime*Movespeed; //End RollGUI. Endscrollview (); } }
Lamp
Summarize
Unity3d Text Scrolling Marquee effect