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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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:
    759
  3. sayacienes

    sayacienes

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