Hi,
Here is the behavior i am seeing on Unity 5.6.1f1:
I have an empty TMP input field set to “multiline new line” that has an attached scrollbar.
I type in enough text for it to become scrollable (e.g. a bunch of newlines) and then use the mousewheel to scroll.
The text and scrollbar will then jump all the way back to the top instead of scrolling from the current position.
After that it behaves as expected scrolling up and down.
Hope there is an easy fix for it. I can provide a simple scene that has this behavior for me if needed
A simple repro would be most useful. Also make sure you are using the latest release of TMP which is 1.0.55.56.0b12 in the case of Unity 5.6.
- Update -
I was able to reproduce the behavior you have reported and believe I have a solution for it. This will need further testing but I’ll provide an update as soon as possible.
P.S. I presume you are using the free version of TMP right?
Oh yes i forgot to say i use the free version. I assume it’s the latest version since i just downloaded it from the asset store yesterday. Thanks for looking into it!
I take it this problem hasn’t been fixed. I am using the Unity TMP InputField with ScrollBar, and when I append the text via code, it scrolls to the top. Where is the ‘current scroll position’ stored?
I did make improvements in the latest versions of TMP which are 1.4.1-preview.1 for Unity 2018.3 and 2.0.1-preview.1 for Unity 2019.1. Note 1.4.1 and 2.0.1 will be available this week and are the same as those previews.
I still have additional improvements coming in subsequent releases. Please be sure to re-test the above and report your findings / other potential issues.
var textComponent = textField.textComponent;
var textViewport = textField.textViewport;
textComponent.rectTransform.anchoredPosition = new Vector2(textComponent.rectTransform.anchoredPosition.x, (textComponent.preferredHeight - textViewport.rect.height) * 1);
to scroll it to the bottom. Replace ‘1’ with any relative number if needed. It is how it is done in TMP_InputField itself as a behavior on scrollbar scroll.
This is still an issue- I’m using TMP 3.0.1 on Unity 2020 1.4f1. When you manually enter text in the expanding TMP input box with scroll bar, it works as expected- The scroll bar size increases as more text is entered. The problem is if you exit the field and left click>drag the scroll bar to move the displayed input up\down, as soon as you release the mouse button, the scroll bar will immediately snap to the top.