Search Unity

Scaling button based on background image, and not based on text

Discussion in 'UI Toolkit' started by GetCrab, Feb 28, 2021.

  1. GetCrab

    GetCrab

    Joined:
    Dec 5, 2015
    Posts:
    1
    Hi,
    I am new to UI Builder, and was wondering if there is a way to scale button based on background image. I don't want to set both width and height to 100px, or something like that, because I am building mobile app (different screens - different size). What I was looking at was setting width of VisualElement to 15%, and placing button in it, with align-stretch. No matter what I tried button height was never expanding to fit background image. I then noticed that button was scaling only based on text size, and not background image, which usually makes sense, but I need it to scale with image.

    Or by different approach, is there any way to set height to be the same as width of button?
     

    Attached Files: