简体   繁体   中英

How to make a Text scroll alongside an InputField in Unity?

I am currently in the progress of designing the UI for my little coding game made in the current version of Unity and want to show line-numbers for the code editor. My problem is that I somehow need to get the Text object for drawing those numbers to "scroll" alongsside the Text of my InputField in order for it to make sense.

Is there any variable on the InputField that contains information about how far it scrolled? Is there a function I can call? Do I have to connect both the InputField and the Text somehow?

简化层次结构 如果我要再添加一行,InputField 会向下滚动,但行不会改变。

Install TextMeshPro package from the package manager, it has a built in input field that supports scrolling out of the box without any coding.

It is also the future of unity's text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM