If user is still typing unconfirmed text and hasn’t confirmed which words they want to use, the text will be underlined. At this point if they press “enter” they expect to confirm the text rather than submit the text field. In Unity I have a method that’s triggered naively by pressing enter, but how do I modify it to avoid triggering if the user pressed enter only to finalize their Chinese text?
It’s kinda frustrating that it apparently used to be supported a long time ago, in the old input system, as documented in: Unity - Scripting API: Input.compositionString
The documentation proceeds to say, that this is no longer supported because it’s only for the old input system. It then links to a completely generic link about the new input system in general with absolutely nothing to do with the original topic (IME composition strings).
Actually, despite the warnings, Input.compositionString worked perfectly in the new input system and was a 2-line fix. Just avoid doing the action if Input.compositionString is null or empty. It’s more or less global so there’s only one check you need to do to cover all your bases.