← Keyline on 4ssets Quick Start Manual Live demo ▶

Keyline — Quick Start

An outline on screen in ten minutes. Everything else is in the Manual.

1 Import and open the demo

Import the package — it lands in Assets/4ssets/Keyline/ — and wait for the compile. There is no renderer feature to add for a hard-edged outline, no volume to author and no layer to reserve. Two things are optional and both are one tick in Project Settings ▸ Keyline ▸ Rendering Passes: a soft 3D rim, and per-outline X-Ray layers.

Then open Assets/4ssets/Keyline/Demo/Demo.unity and press Play. Ten chapters, and the fastest way to see what the asset does. Keys 1–0 switch chapters, H hides the panel.

Both URP and HDRP ship in this one package. Which SubShader compiles is decided by the pipeline tag; the demo retargets its own materials on first load, so nothing turns magenta.

2 Your first outline

That is the whole setup. The object has an outline now.

The Keyline Outline 3D component
Every pass, including Main Outline, is added with Add pass. A slot with no profile draws nothing.

3 The four passes

One component draws up to four things, each with its own switch and its own profile:

Mainthe rim, where the object is visible — the ordinary outline
X-Raythe rim, only where the object is behind something
Fillthe object's own surface — damage flashes, gauges, dissolves
X-Ray Fillthe surface, only where the object is hidden
The four passes, one per quadrant
The same object, one pass at a time. Each carries a complete profile, so "its own style" means its own everything.

A mesh has two more, off by default and experimental: a Cutout Overlay on the Main rim and one on the X-Ray rim, which draw that pass a second time so a hull silhouette and an alpha rim can share one object. The manual covers them; nothing here needs them.

4 A sprite instead of a mesh

A SpriteRenderer has its own component and the same everything else — the same profiles, the same styles, the same four passes.

That last step is the one that has no equivalent on a mesh. A mesh outline is an inverted hull; a sprite has no hull to push, so its rim is measured against a distance field built from the artwork’s own alpha. It is baked once, next to the texture, and from then on the outline follows what is drawn — around a hole in the middle of the sprite as readily as around its edge.

5 Drive it from code

using FourSsets.Keyline;

var outline = target.GetComponent<KeylineOutline>();

outline.MainOutlineEnabled = true;      // switch the rim on
outline.Color = Color.red;              // recolour it
outline.Width = 0.04f;                  // metres, in World width mode
outline.XRayEnabled = true;             // show it through walls too
Go through the component, not the profile. A profile is a shared asset: a hundred objects using one profile are using one object in memory, so outline.Settings.color = red turns all hundred red — and in the editor the change survives play mode. outline.Color = red forks the profile into a copy this object owns before writing. That is on by default, and it is the one thing worth knowing on day one.

Adding an outline at runtime is the same three lines, plus where to put them:

var outline = enemy.AddComponent<KeylineOutline>();

outline.Configure(main: hostileProfile, xray: seeThroughProfile);

Configure fills the slots in one go, which matters when you are spawning: assigning them one at a time rebuilds the outline once per slot. Showing and hiding is free either way — outline.OutlineEnabled = false takes it off screen without dismantling it, so a pooled object comes back for nothing.

6 Thirteen components you do not have to write

Runtime/Recipes/ holds the arrangements people usually end up writing themselves: hover, click selection, trigger and proximity highlights, damage flashes, gauges painted on the model, impact and scan waves, materialising, squad highlighting, through-walls markers, blink.

They are ordinary components written against the same public API you have. Add Keyline ▸ Highlight (arbiter) plus a collider to a prop, drop Keyline ▸ Pointer Highlight (scene) anywhere in the scene, and hovering works — one raycast per frame for the whole scene, nothing registered, nothing wired.

A gauge drawn on the model
Fill Gauge: a level painted on the object rather than floating over its head. One shader parameter, so it costs the same at any value.