Search Unity

Incorrect caret position with InputField on World Space Canvas

Discussion in 'UGUI & TextMesh Pro' started by PapaSid, Oct 3, 2021.

  1. PapaSid

    PapaSid

    Joined:
    Apr 12, 2013
    Posts:
    1
    Hi, I've been trying to tackle this issue for a few days now. The problem I'm having is the caret position on my TextMeshPro InputField is completely off (different from where I'm actually clicking), vertically and horizontally. The position of the caret goes to the same incorrect spot each time I click the same character. I might be butchering the explanation so I've attached a video of the problem.

    The Canvas is in world space on a desk in my scene, and the InputField is supposed to represent a piece of paper. I have the input field set to multi-line newline. I have tried replacing the default
    InputField>Text Area RectMask2D component with a normal UI/Mask component, but that doesn't affect anything. Using different fonts and font sizes doesn't change the behavior.

    I was able to reproduce the issue in a brand new scene. The only "solution" I've been able to manage so far is changing the Canvas to "Screen Space - Camera" instead of World Space, which fixes the caret placement issue, however, I'm trying to make the input field look like a piece of paper on a desk so I need the canvas to exist in 3D space. I feel like the issue could be related to how the camera is rotated in relation to the Canvas, but I have no idea where to even start debugging this. I've been scraping the forums all day and haven't found a solution, or even anyone with a similar problem.

    Unity 2020.2.6f1
    TextMeshPro 3.0.1

    Video here

    Thanks
     
  2. Aldeminor

    Aldeminor

    Joined:
    May 3, 2014
    Posts:
    18
    Bump. Had same issue, in fact can't use TMP_InputField at full capacity because of this. I'm making VR app and the world-space UI is an essential part of it.
    The setup:
    Unity 2021.3.17 + XR Interaction Toolkit

    In some cases the caret was behaving normally in Editor, but was off in Android build (Quest 2), but then I changed the layout and it became broken even in Editor.

    Any ideas for fix/workaround?

    I has googled world space UIDocument on GitHub, but the solution is experimental and is not stable, but I would appreciate if Unity finally will go ahead and finalize their state with UI Elements so it would be production ready with full feature set as UGUI has today, but more polished and streamlined.
     
  3. oesteerigrek

    oesteerigrek

    Joined:
    Dec 12, 2017
    Posts:
    6
    I am experiencing the same problem. With XR Interaction Toolkit and Unity 2022.3.11f1 for world canvases with TMP_InputField the cursor is visible in the unity editor, on quest3 device no cursor shows up.