Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro TextMeshPro multiline InputField scroll issues with PageUp/PageDown keys

Discussion in 'UGUI & TextMesh Pro' started by Zak_McKracken, Apr 15, 2019.

  1. Zak_McKracken

    Zak_McKracken

    Joined:
    Mar 8, 2015
    Posts:
    4
    Hi pals,

    I'm having some issues when scrolling a multiline InputField using PageUp/PageDown keys:

    Even if the text doesn't need to scroll, when pressing PageDown key, the text goes all the way down disappearing from view. Then, when trying to go up again using PageUp, it slowly scrolls up as you can see in the screenshot below:

    InputFieldScroll.gif

    I suppose this is a bug, but is there a workaround for this issue? As the source code of TMP isn't public and the legacy InputField doesn't support scrolling with PageUp/PageDown keys, I don't have a clue of what's going on.

    Thanks in advance!
     
    cuddlepunk likes this.
  2. Zak_McKracken

    Zak_McKracken

    Joined:
    Mar 8, 2015
    Posts:
    4
    Anyone? Am I the only one with this issue?
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll try taking a look at this later tonight or over the weekend.

    The package manager version of TextMesh Pro include source code. You can access the various scripts by navigating to the Packages folder in the project as seen below.

    upload_2019-4-19_15-24-52.png

    Note that changes made there are only done to the local cached version of the package located in the local project's "Library/PackageCache/..." folder.
     
  4. Zak_McKracken

    Zak_McKracken

    Joined:
    Mar 8, 2015
    Posts:
    4
    Great to know, Stephan!

    I know it's a minor bug, but as I'm making a game that teaches programming, it's important that the InputField works flawlessly.

    Looking forward for a fix!

    Thanks!!
     
  5. Zak_McKracken

    Zak_McKracken

    Joined:
    Mar 8, 2015
    Posts:
    4
    Hi! Any news on this issue? Thanks!
     
  6. alan-lawrance

    alan-lawrance

    Joined:
    Feb 1, 2013
    Posts:
    360
    I'm having the same issue. I would be content with just being able to disable Page Up/Down in a multi-line input field.
     
  7. cuddlepunk

    cuddlepunk

    Joined:
    Apr 9, 2014
    Posts:
    18
    Resurrecting this thread because this is still a reproducible bug, PageUp and PageDown keys still cause a multiline input field to scroll.

    However, I have managed to find a temporary solution.
    It appears that tapping PageUp or PageDown causes the RectTransform.anchoredPosition to shift on the visible input field, alongside the RectTransform.anchoredPosition of the caret the input instantiates.

    The solution is simply to revert their positions when the PageUp and PageDown keys are tapped.


    Code (CSharp):
    1. if (Input.GetKeyDown(KeyCode.PageUp) || Input.GetKeyDown(KeyCode.PageDown))
    2. {
    3.         caret.anchoredPosition = Vector3.zero;
    4.         input.anchoredPosition = Vector3.zero;
    5. }