Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to implement parameter lists such as mecanim??

Discussion in 'UI Toolkit' started by fsngshao, May 18, 2023.

  1. fsngshao

    fsngshao

    Joined:
    Sep 6, 2022
    Posts:
    6
    When click "New Int", will show inputText.
    upload_2023-5-18_23-24-37.png
    When click another visual element, will hide inputText.
    upload_2023-5-18_23-25-2.png

    This is my code,but "focus" not work.
    upload_2023-5-18_23-27-46.png
     
  2. oscarAbraham

    oscarAbraham

    Joined:
    Jan 7, 2013
    Posts:
    431
    It can be tricky to change focus during MouseDown, and it can also be tricky to focus elements immediately after making them visible. A quick fix is to delay the call to Focus. You could use delayCall or UITK's schedule.

    I have a package with stuff for UI Toolkit in the Editor. It contains an EditableLabel element that's designed for this sort of thing. Here it is in case it helps: https://github.com/OscarAbraham/UITKEditorAid
     
    spiney199 likes this.
  3. fsngshao

    fsngshao

    Joined:
    Sep 6, 2022
    Posts:
    6
    Thanks, I have downloaded the package, It's great
     
    oscarAbraham likes this.