Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

box-shadow Property

Discussion in 'UI Toolkit' started by hanhanxue, Dec 12, 2020.

  1. hanhanxue

    hanhanxue

    Joined:
    Nov 28, 2020
    Posts:
    5
    Are there plans to add support for box-shadow property in uss? What's a good way to add a drop shadow to a button using what's currently available?
     
  2. mcoted3d

    mcoted3d

    Unity Technologies

    Joined:
    Feb 3, 2016
    Posts:
    1,011
    It is planned!

    Right now, however, your best bet would probably to create a 9-sliced texture and assign it as the background an element that will act as the shadow.

    To make slices, you can either use the USS styles (
    -unity-slice-left
    , etc.). Or simply use a sprite with borders (https://docs.unity3d.com/Manual/9SliceSprites.html).
     
    Deeje and hanhanxue like this.
  3. hanhanxue

    hanhanxue

    Joined:
    Nov 28, 2020
    Posts:
    5
    Thanks for the reply @mcoted3d!
     
  4. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    It's been a year. I am just switching my project over to the Unity UI Toolkit.

    I was using the True Shadow addon:
    https://assetstore.unity.com/packages/tools/gui/true-shadow-ui-soft-shadow-and-glow-beta-176322

    On my regular UI, but now that I am moving to UI Toolkit it seems I am stuck. Is this something someone could develop a similar third party solution script for or do you have an ETA on completion of your shadow option?

    This is honestly quite critical and it's hard to work without it.
     
    Neuro2019 likes this.
  5. crowbar1

    crowbar1

    Joined:
    Jan 14, 2016
    Posts:
    2
  6. tattyd

    tattyd

    Joined:
    Feb 17, 2020
    Posts:
    14
    Deeje and GoShaders like this.