The existing post, “TextMeshPro incorrectly exposed,” has been marked as Complete. Thank you for addressing the issues raised there.
However, many APIs, such as TMP_CharacterInfo, are still unavailable from Udon. There are operations that can be performed with Legacy uGUI but not with TextMeshPro, which creates difficulties when migrating existing systems or implementing new functionality.
I would therefore like to request that the following APIs also be exposed to Udon.
Input Position and Selection Range Control
In particular, I would like it to be possible to get and set the caret position and selection range of TMP_InputField.
With the Legacy InputField, it is possible to insert predefined text or emoji at the current input position, replace only the currently selected text, and adjust the caret position after text completion or replacement.
However, because the corresponding TMP APIs are not exposed, these editing features cannot currently be migrated as-is.
  • caretPosition
  • selectionAnchorPosition, selectionFocusPosition
  • MoveTextStart(bool), MoveTextEnd(bool)
  • stringPosition
  • selectionStringAnchorPosition, selectionStringFocusPosition
It is possible to replace the entire string using text or SetTextWithoutNotify(), but these do not provide access to the caret position or selection range maintained by the input field, so they cannot serve as substitutes for these editing operations.
Since migration to TMP is also recommended in the official documentation, it would be very helpful if the basic editing functionality available in Legacy UI could also be used with TMP.
For example, attempting to access the caret position results in a compilation error with the following code:
using TMPro;
using UdonSharp;
using UnityEngine;
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class ApiProbe : UdonSharpBehaviour
{
[SerializeField] private TMP_InputField _inputField;
public void _Probe()
{
Debug.Log(_inputField.caretPosition);
}
}
Method is not exposed to Udon: '_inputField.caretPosition'
Input Settings and Cancellation State
I would also like the following APIs to be available from TMP_InputField, as they are with the Legacy InputField.
  • characterLimit, characterValidation
  • contentType, inputType, lineType
  • wasCanceled
  • caretWidth, caretBlinkRate
  • caretColor, customCaretColor, selectionColor
  • asteriskChar
When reusing the same input field for different purposes, it is useful to be able to change the character limit, input restrictions, input type, and password display behavior.
These APIs are also needed to determine whether input was canceled and to adjust the visibility of the caret and selection range.
Post-processing the resulting text cannot control behavior during input in the same way, and preparing multiple separate input fields with different configurations also adds unnecessary complexity.
It would be greatly appreciated if the settings and state of the input field itself could be accessed and modified directly from Udon.
Input Activation, Deactivation, and Display Updates
I would like TMP_InputField.ActivateInputField() to be callable from Udon. The Legacy InputField.ActivateInputField() method is exposed, but the corresponding TMP method is currently unavailable.
I would like to be able to activate an input field in response to a button press or UI transition and immediately begin text input. Please consider exposing this method so that the same behavior used with Legacy InputField can also be implemented with TMP_InputField.
I would also like DeactivateInputField(bool), which ends text input, and ForceLabelUpdate(), which refreshes the input field display, to be exposed as well. The corresponding Legacy InputField methods are available from Udon, but the TMP versions are currently not exposed.
Font, Style, and Text Configuration
Similarly to Text.font and Text.fontStyle in Legacy UI, I would like it to be possible to get and set TMP_Text.font and TMP_Text.fontStyle.
Rich text tags can be used in some situations, but they are not a substitute for reading the current configuration, changing the style without modifying the text content, or directly replacing the referenced font asset.
It would also be helpful if TMP_Text.SetText(string) and SetCharArray(char[]) were exposed.
In addition to assigning to text, I would like to be able to use TMP's own methods to set text from strings or character arrays.
Character, Line, Word, Link, and Page Information
In addition to the arrays available through textInfo, I would like the fields and methods of the following types to be exposed as well.
  • TMP_CharacterInfo: source string index, character coordinates, line number, corresponding vertices and material information, etc.
  • TMP_LineInfo: character range contained in the line, line width and height, baseline information, etc.
  • TMP_WordInfo: character range contained in the word, character count, GetWord(), etc.
  • TMP_LinkInfo: link character range, GetLinkID(), GetLinkText(), etc.
  • TMP_PageInfo: character range contained in the page, height-related information, etc.
Currently, even when the arrays themselves can be accessed, attempting to read information such as a character index results in an error.
Debug.Log(_tmpUGui.textInfo.characterInfo[0].index);
Field is not exposed to Udon: '_tmpUGui.textInfo.characterInfo[0].index'
Operations such as text selection, caret placement, and link interaction require information that maps the original string to the rendered output.
Access to vertices through meshInfo alone does not provide this mapping, which makes it difficult to correctly handle text containing spaces, line breaks, rich text, or fallback fonts.
Along with these types, I would also like TMP_TextUtilities.GetCursorIndexFromPosition(), FindIntersectingCharacter(), and FindIntersectingLink() to be exposed so that interactions can be implemented based on the rendered positions of characters and links.
Text Measurement and Page Control
I would like TMP_Text.GetPreferredValues(string, float, float) to be exposed so that arbitrary strings can be measured against specified width and height constraints without changing the currently displayed content.
LayoutUtility can be used to obtain the size of the current UI element, but this API is necessary when measuring a candidate string under specific constraints before displaying it.
It would also be helpful to have access to GetRenderedValues() and GetParsedText() in order to retrieve the dimensions of the rendered result and the text after rich text parsing.
In addition, I would like the following properties to be exposed for cases such as displaying long descriptions or book-like content page by page, or determining which parts of the text cannot be displayed.
  • pageToDisplay
  • isTextOverflowing, isTextTruncated
  • firstOverflowCharacterIndex
TextMeshPro Redraw and Vertex Updates
I would like ForceMeshUpdate(bool, bool) and UpdateGeometry(Mesh, int), which are exposed for TextMeshProUGUI, to also be available for TextMeshPro using a MeshRenderer.
I would also like TMP_Text.UpdateVertexData() to be exposed so that rendering information can be refreshed immediately after changing text and so that modified character vertices can be applied to the rendered output.
Access to transform and rectTransform
Directly accessing TMP's transform or rectTransform from UdonSharp results in compilation errors depending on the declared variable type.
  • TMP_Text: transform = Compilation error, rectTransform = Compilation error
  • TextMeshPro: transform = Compilation error, rectTransform = Compilation error
  • TextMeshProUGUI: transform = Available, rectTransform = Compilation error
using TMPro;
using UdonSharp;
using UnityEngine;
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class ApiProbe : UdonSharpBehaviour
{
[SerializeField] private TMP_Text _text;
public void _Probe()
{
Debug.Log(_text.transform);
}
}
Method is not exposed to Udon: '_text.transform'
Replacing _text.transform with _text.rectTransform results in a similar error.
Method is not exposed to Udon: '_text.rectTransform'
However, these properties can be accessed if the base type is explicitly specified.
var transform = ((Component)_text).transform;
var rectTransform = (RectTransform)((Component)_text).transform;
The RectTransform can also be obtained using GetComponent<RectTransform>().
var rectTransform = _text.GetComponent<RectTransform>();
This means that normal property access can fail depending on the declared variable type even when referring to the same object, requiring users to work around the issue with explicit casts or GetComponent.
It would be helpful if the resolution of TMP property getters and the fallback to already-exposed base-class APIs could be reviewed so that these properties can be accessed directly as well.
Tested with: VRChat SDK 3.10.5
In particular, I would greatly appreciate consideration for exposing the APIs necessary to preserve editing functionality based on caret position and selection ranges when migrating from Legacy UI to TextMeshPro.