Setup

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

Setup step 2

3. Assign the new material to the Sprite Renderer(s) of your sprite(s).

Assign material to game object

Setup step 3

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.

An outer outline is drawn on the transparent area around your sprite, and it can only appear where the sprite actually has a mesh. Set up your sprites as described below to keep the outline from being cut off. All included demo sprites are set up this way. An inner outline stays inside the sprite, so it does not need this room.

To make room for an outer 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.

The 2D Renderer combines emission and albedo color into a single channel, so the same material will look different on the Universal Renderer and on the 2D Renderer. As on the Universal Renderer, the outline is not affected by the lights in your scene.