Search Unity

Feature Request USS support for calc

Discussion in 'UI Toolkit' started by Robstao, Nov 10, 2022.

  1. Robstao

    Robstao

    Joined:
    Jan 23, 2019
    Posts:
    11
    I don't believe there's any solution for using calc within uss. It super helpful when aligning elements.

    i.e. without using vars

    .button {
    width: 50px;
    height: 100px;
    }

    .button-container {
    position: absolute;
    bottom: 150px;
    left: calc(50% - 25px);
    }


    would center the button without creating a larger-than-needed container and overlap, not needing a z-index either in this case.
     
  2. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
  3. sayacienes

    sayacienes

    Joined:
    Oct 1, 2019
    Posts:
    18
    It is definitely needed. please support "calc" as soon as possible :(
     
  4. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,941
  5. ZivVek

    ZivVek

    Joined:
    Apr 21, 2021
    Posts:
    3