Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

CSS border width and colour do not work in 2019.3.0b1

Discussion in 'UIElements' started by Cence99, Sep 8, 2019.

  1. Cence99

    Cence99

    Joined:
    Apr 14, 2013
    Posts:
    39
    I have used the border feature a lot in my project and it worked fine, however, when upgrading from 2019.1 to the beta version 2019.3.0b1, all the borders are gone. The only thing that seems to work is border-radius to round the edges.

    For reference, this is the CSS code I used in 2019.1:
    Code (CSharp):
    1. border-radius: 5;
    2. border-style: solid;
    3. border-width: 2;
    4. border-color: rgb(33, 33, 33);
    Please let me know if I missed anything or if this is indeed just a bug in the beta.
    Thanks in advance!
     
  2. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,373
  3. NotGoodEnoughh

    NotGoodEnoughh

    Joined:
    Feb 1, 2018
    Posts:
    35
    Probably you need to change
    border-color: rgb(33, 33, 33);
    to
    border-color: rgba(33, 33, 33, 1.0);

    Because by default border's alpha is 0.
     
  4. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    61
    Hi Cence99,

    border-style
    is not a supported property. If you are on 2019.2 and above there's a USS validation system so you should see a warning in the console about this when the style sheet is imported.

    border-color: rgb(33, 33, 33);
    is correct and will have an alpha of 1.0.

    Code (CSharp):
    1. .border {
    2.     border-radius: 5px;
    3.     border-width: 2px;
    4.     border-color: rgb(33, 33, 33);
    5. }
    The USS above is valid and should work on 2019.1 and above. If you don't see the borders it probably mean that the rule was not applied or that another rule is overwriting the values.
    In that case I suggest that you open the UIElements debugger (CTRL+F5) and look at the style property values for your element.
     
    NotGoodEnoughh likes this.