The Outline Shader is, in principle, the same as the regular lit shader you would use in your Unity project, only reconstructed and expanded. The setup is thus the same as with any other lit shader.
The shaders and demo scenes come in two versions. Use the Universal Renderer folder if your project uses the Universal Renderer (the default for 3D projects), or the 2D Renderer folder if it uses the 2D Renderer (the default for 2D projects).
1. Create a new material for your sprite(s).
2. Select the material, then select Project G.A.M.E.D.E.V./Essential 2D Shaders/Outline Shader as its shader (or Outline Shader - 2D Renderer if you use the 2D Renderer).
Assign shader to material
3. Assign the new material to the Sprite Renderer(s) of your sprite(s).
Assign material to game object
4. That's it! The shader is now active, and the Sprite Renderer passes its sprite to the shader on its own. Experiment with the material options until you find an outline you are happy with.
To make room for an outer outline:
- Set the Mesh Type of your sprite to Full Rect in its import settings. A Tight mesh hugs the shape of the sprite and leaves the outline no room.
- Leave transparent padding around the sprite in its texture that is at least as wide as the Outline Width.
- Keep the Wrap Mode of the texture on Clamp.
- If your sprite is packed into a Sprite Atlas or a sprite sheet, keep the sprites at least one Outline Width apart. Otherwise, neighbouring sprites will show up in the outline.
Keep in mind that post-processing (most notably Bloom and Tonemapping) has a profound effect on the outline, especially when the Outline Color has a high HDR intensity. The demo scenes ship with the post-processing profile they were authored with, which you can find in the Post-Processing Profiles folder.
In case you wish to animate the outline, attach OutlineController.cs to an object in your scene.
See Controller Script for details.