Sprite outline shader using Shader Graph in Unity - tutorial
Add an outline to sprites in Unity using this Shader Graph shader. I explain how the shader works and mention its limitations in this tutorial.
Link to download the Shader Graph shader:
https://www.dropbox.com/s/bq7dfipe26zb1yb/Sprite-Outline.shadergraph?dl=0
Link to the Unity Shader Graph examples project:
https://github.com/UnityTechnologies/ShaderGraph_ExampleLibrary
Follow on Twitter: https://twitter.com/StoneBakedGames
A few tips that might help if you experience problems:
1) If the outline becomes jagged or weird looking, try setting the sprite import setting for Mesh Type to Full Rect. This expands the mesh used by the sprite renderer to the full extent of the image, rather than cropping it tightly to the visible part.
2) If the sprite image is not square you may find that the outline isn't a uniform thickness. Try changing the sensitivity value for the x and y axes so that they have the same aspect ratio as the sprite (i.e. the x/y ratio should match the width/height ratio).