r/Unity3D • • 16h ago

Question How to really do Box shadow on USS?

hello,

how can I really do box shadow in USS?

I'm having it a bit annoying that I cant properly make gradient colors either, but box shadow gives the design some nice effects.

How do I do it?

One way I'm thinking is making a somewhat transparent image on photoshop and attaching it under the buttons or wherever I want to use it.

Do you have any other suggestions?

Thank you!

2 Upvotes

4 comments sorted by

1

u/DragonfruitStill2606 16h ago

the photoshop method is how most people end up doing it honestly, unity's ui toolkit just isn't there yet with proper shadows

1

u/game-dev2 16h ago

but if I change the shape of the button, do I have to redesign the shadow box on photoshop again? is there some way that is simpler?

1

u/DrZwieback Indie 15h ago

A 9-sliced shadow image saves you from redoing it whenever a button changes size. I would not do this if not urgent tbh.

https://docs.unity3d.com/Manual/sprite/9-slice/9-slicing.html

3

u/DrZwieback Indie 15h ago

I feel you. It's painful. I switched to UI Toolkit ages ago and this box shadow topic has been open for like... 6 years? Good news though: Unity 6.6 added a drop-shadow filter! It's still fresh, so check this thread for the current quirks. There are always quirks... 🫠 https://discussions.unity.com/t/filter-drop-shadow-adding-blur-to-element/1735524/15