- Home /
How to make outlines around 2d objects?
I am trying to figure out a somewhat simple yet niche outlining method. I need to be able to produce outlines around both SpriteRenderers AND UI Image components.
Also, and this is the most tricky. I would also like so that, if the camera zooms in or out, the outlines stay the same physical size. This last one is very tricky/strange wishful thinking though. If you have an answer to just the first part, I would like to hear that as well!
What types of sprites you have? Pixel art or something else? Also I think most UI objects have an Outline component which you can add to create an outline for them
They are not pixel art - higher resolution. Also, yes I just discovered the Outline component for UI. Is there a method for outlining SpriteRenderers that mimics/looks exactly how the Outline component works?
Well, one possibility I can think of now is that you create a duplicate of your sprite, make it a child of your original sprite, color the duplicate sprite black or whatever you want the outline color to be, and then scale it just a tiny amount bigger than your original sprite and position it correctly under your original sprite. You should now get a somewhat decent outline effect. Here is an image to show you what I mean.
I also remember that in this Brackeys video he made an outline glow effect using URP and shader graph. I guess you could use this but if you don't want the glow effect you could just make the colors intensity 0 so it doesn't glow.
Answer by BuzzyRoboYT · Mar 13 at 12:48 PM
There is a video by Brackeys that shows how to make an outline shader for 2D, that might help.
Your answer
![](https://koobas.hobune.stream/wayback/20220613054124im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Silhouette Toon Shader 0 Answers
GUIText Outline Shader 1 Answer
Toon shader mobile issue 1 Answer