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 TextField, TemplateContainer and Animations

Discussion in 'UI Toolkit' started by mechaniqe, Jul 20, 2020.

  1. mechaniqe

    mechaniqe

    Joined:
    Jan 25, 2017
    Posts:
    18
    Hello,

    I am very excited to learn and (potentially) apply UI Toolkit to an upcoming project. Have been experimenting with it for a few days now and really like the direction it is moving in. That being said, there are a few things I would appreciate help with:
    1. Seemingly I am unable to write into TextField at runtime, only delete from it. Is it just me?
    2. Is there a plan to support TextField placeholder in the near future (or perhaps it's hidden somewhere)?
    3. When I make use of UIDocument to attach the UXML to the page, it auto adds
      TemplateContainer as a parent (obviously, as the UXML may have multiple elements at its root), which is cool. The issue was that the TemplateContainer doesn't "grow", so I had to write a query that finds it and resolves that manually. Is that the "normal" way of doing it?
    4. Any rough ETA for animations? What I actually need is pretty basic: To get UIDocuments move in and out of the screen. Any way to achieve that with current functionality?
    Note: I am using UI Toolkit version 1.0.0-preview.3 on Unity 2020.1.0b15

    Cheers,
    Sahin
     
  2. manuelgoellnitz

    manuelgoellnitz

    Joined:
    Feb 15, 2017
    Posts:
    365
    1. You need to add the "Default.uss" stylesheet file in the PanelSettings in order for textfield to work properly
    2. +1
    4. There are some animations allready there like this example:

    Code (CSharp):
    1. panel.experimental.animation.Start(from: 0, to: 100, durationMs: 1000, (p, value) => { p.style.left = value; }).easingCurve = Easing.InOutCubic;
     
  3. mechaniqe

    mechaniqe

    Joined:
    Jan 25, 2017
    Posts:
    18
    I do have a USS file assigned to Panel Settings (which was created by myself). That being said, no idea where to get the "Default.uss", as I don't have it in my project.

    Thanks, will give it a try.
     
  4. Digika

    Digika

    Joined:
    Jan 7, 2018
    Posts:
    225
    Alternatively you could probably position absolutely and modify width/height and transform but it is gonna be very costly. Really curious how can we control layers and batching, with modern CSS/HTML5 it is fairly understood task.

    Altho, seeing that animation snippet example I guess it is gonna be done per-panel. Which can kinda suck if you make responsive UI in flex because new panel will render new object and it wont participate in layout/flex,
     
    Last edited: Jul 20, 2020