Search Unity

Question Meaning of "initial" setting for visual element properties

Discussion in 'UI Toolkit' started by SuperMops, Jun 17, 2022.

  1. SuperMops

    SuperMops

    Joined:
    Feb 7, 2018
    Posts:
    28
    Many properties in the UI-Builder can be set to a value called "initial".
    (Like size, flex-basis, flex-grow, flex-shrink and others)

    I wasn't able to find any documentation on that setting.

    I know that there is a flex:initial value in the web version of flexbox, but since this setting
    is also available for settings unrelated to flexbox i assume those are different things.

    Could someone explain what "initial" does and when to use it?
     
  2. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    I really don't know the details, but the Intellisense text can be seen in a editor for StyleKeyword.Initial:

    upload_2022-6-30_16-13-52.png
     
    SuperMops likes this.
  3. SuperMops

    SuperMops

    Joined:
    Feb 7, 2018
    Posts:
    28
    So that would mean that it's purpose is to reset a style to whatever it's default value was I guess. It's just a bit confusing that you can also set this in UI Builder since for most styles the default is auto and you can also set it to auto.

    I guess setting it to initial has the same effect as setting it to auto for those styles.

    Thanks for your help.
     
  4. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    324
    Only for the sake of completeness: In another thread it was especially mentioned what "initial" means and what it is used for:

    (Thread: https://forum.unity.com/threads/ui-builder-has-very-flawed-ux.1307613/#post-8275050)
     
    stefania_unity and SuperMops like this.
  5. stefania_unity

    stefania_unity

    Unity Technologies

    Joined:
    Jan 27, 2021
    Posts:
    12
    Thanks for including this here. I've added this topic as something for our documentation members to review.
     
    FaithlessOne likes this.