What's the best or easiest approach to apply an outer glow effect to a UI game object -- let's say, a popup dialog, so it's a rectangular shape -- in Unity 2018.3?

Is this something that should be done with a shader, or is it a particle effect?

Ideally I should be able to specify and perhaps even dynamically adjust the color and size of the glow.

Edit: image below shows a blue rectangle, which has this subtle, grey glow around it. I'm hoping to generate this glow effect somehow in Unity.

enter image description here

  • \$\begingroup\$ Can you show us some examples of what you'd like to achieve? \$\endgroup\$
    – user115399
    Jan 15, 2019 at 8:48
  • \$\begingroup\$ @GabrieleVierti I've added an image which hopefully explains better what I'm trying to achieve. \$\endgroup\$ Jan 15, 2019 at 10:14
  • \$\begingroup\$ If it's just UI, then you could just use a white sprite for that; This way you can quickly change its color in the editor ;) \$\endgroup\$
    – user115399
    Jan 15, 2019 at 14:47
  • \$\begingroup\$ The color, but not the size, or other traits like the nature of the gradient, unfortunately. :) \$\endgroup\$ Jan 15, 2019 at 14:51
  • \$\begingroup\$ Well then, you can use a shader that linearly-interpolates between [COLOR] and another one where the alpha is set to 0, based on a threshold you specify. You can then create a texture and apply the latter to the UI quad. I have no idea on how to do it in practice unfortunately, but you'd need to use a shader for that! \$\endgroup\$
    – user115399
    Jan 15, 2019 at 14:55

1 Answer 1


You can create a .png that has alpha with a gradient, that will create the shadow. You can then use the 9-slice to be able to seamlessly scale it to any size you want and keep the same resolution. You can then set it as a parent to the object so it will be rendered under it.

  • \$\begingroup\$ I've tried this already, but it requires an extra Image component in the hierarchy and it's still not nearly as flexible as the effect I can get in Photoshop, for example. \$\endgroup\$ Jan 17, 2019 at 8:41
  • \$\begingroup\$ Can you show what you have in engine and the fade inspector? You will have to sacrifice a second image hierarchy whether using an overlay or a mask layer; unless you would want to do a shader but I'm not much help with them. \$\endgroup\$
    – Ran Crump
    Jan 17, 2019 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .