Forum rules - please read before posting.

Is there any support for TEXT INPUT for commands?



  • Hopefully, this will be the last thing I need help with. When the player enters a string which is not in any of the listed interactions, I want the input field to be erased. This worked in an earlier version of my script (as shown above in the "else" part), but doesn't work now, probably due to TMP.

    For TMP, I've also tried :

    public TMP_InputField field;
                        field.text = "";

    But no luck, as I don't know how to specify that field in the inspector for the TMP input field GameObject which is a child of the menu prefab. What can I do?

  • You can use the MenuInput element's SetLabel function to update the display text regardless of source. Though, this too will need updating to work with TMPro:

    public void SetLabel (string _label)
        label = _label;
        if (uiInput) uiInput.text = _label;

    I will make the same change to the next release.

  • edited August 2022

    Thanks! I still have a few issues though, mostly with forcing the cursor to focus after entering a word once/ on opening the menu a second time. I've tried so many different solutions with varying results that it's difficult to choose which one to discuss here.

    It seems setting the menu to Pause the game when launching the menu is the most reliable option for getting the cursor to show up. If the player enters a word that is "correct", the menu closes and the associated interaction runs correctly, and the cursor shows up again if the player interacts/ opens the menu again. But, if the typed input is "wrong" I want the menu to just erase everything while the menu stays on. This works, but here the cursor disappears. One way to force the cursor to show up is to turn the menu off upon entering an incorrect term, and then forcibly reopen it with a 0.1 second delay.

    But AC only allows the "Turn On" menu through Action Lists for Manual menus, not for those set to On Interaction. Is there a way to edit this Action so that even On Interaction menus can be turned on using that Action? As a workaround, I've set the menu to Manual and am currently using a dummy menu that then "manually" launches the input menu through its "Action List when turn on" option. But this feels a little messy.

    Or even better, an Action to directly close and reopen a menu?


    I made the above work by adding this code in the "else" statement in the Parser code. This works great, but there's one issue - it ONLY launches the associated interaction when I type "talk" - no other word works. If I remove this section, everything works perfectly (but I lose out on the focus when entering a wrong option and clearing the field) Any idea what could be causing this?

    AC.Menu _menu = PlayerMenus.GetMenuWithName("InputText");
    ActionPause actionPause = ActionPause.CreateNew(0.1f);

    I had to remove the return statement. Still have a slight issue with focusing the Input field when reopening the menu - I have to press enter once to get the focus back, but working on it - almost there hopefully.

  • Both of the if/else branches in your foreach loop end with a "return" statement - meaning the code will always end after processing the first element of the foreach regardless of the outcome.

  • Both of the if/else branches in your foreach loop end with a "return" statement - meaning the code will always end after processing the first element of the foreach regardless of the outcome.

    Yes, I realized and removed the return statement for the else part, it works now. Also fixed the focus issue by forcing the menu to turn off in the "if" part before running the associated interaction. Everything works perfectly now.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.