Skip to content

API Reference

Namespace OutlineZero. Add using OutlineZero; to your script.

The component that makes an object outlined. No component, no outline.

using OutlineZero;
var outlined = target.AddComponent<Outlined>();
outlined.Layer = 2;
outlined.OcclusionMode = OutlineOcclusionMode.Always;
Member What it does
int Layer 1 to 4. Which layer’s colour, width and softness this object uses.
bool AutoTag True by default. Set it to false for Pro Mode.
OutlineOcclusionMode OcclusionMode VisibleOnly (default), Always (through walls), OccludedOnly.
void RefreshRenderers() Call this if you add or remove child renderers under an outlined object while the game is running.

Adding and removing the component at runtime is the intended way to build a selection system, and it is what the Selection & Hover sample does. Changing any of the three properties takes effect on the next frame.

Which renderers it covers: this object and everything under it, stopping at any child that has its own Outlined. A disabled Outlined on a child removes that child from the parent’s outline rather than handing it back.

// Change how outlines look while the game is running:
OutlineZeroSettings.Active.GetLayer(1).Color = Color.cyan;
OutlineZeroSettings.Active.GetLayer(1).WidthPx = 6f;
Member What it does
static OutlineZeroSettings Active The settings currently in use. See the note below.
const int LayerCount 4.
OutlineLayerSettings GetLayer(int layer) Layer 1 to 4.
OutlineLayerSettings[] Layers The same four, counting from 0.
OutlineRenderingMode RenderingMode Performance (default) or Compatibility.
int Downscale 1 to 4. How much detail the outline is built from. Default 2.
bool ReferenceResolution On by default: width is measured at 1080p and scaled to the player’s screen. Off: width is in literal pixels.
bool Scissor On by default. Keeps the outline’s cost to the area your objects cover. Turn it off only to rule it out while debugging.
OutlineStage Stage, OutlineDebugView DebugView Debugging aids.

OutlineLayerSettings: bool Enabled, Color Color, float WidthPx (1 to 16), float Softness (0 to 1).

  • While the game is running: a private copy. Anything you change is forgotten when you stop playing, so your authored settings are never overwritten by gameplay code.
  • In the editor, outside play mode: the settings asset itself, which is what makes an Inspector edit show up immediately.
  • Changes appear on the next frame. There is nothing to refresh or apply.
  • It returns null if the outline system is not set up in the project, and warns once. Worth checking if your project might ship without it.

You normally configure this in the Inspector. These are for tools, tests and in-game diagnostics. They all describe the last frame that was drawn.

Member What it tells you
OutlineZeroSettings RuntimeSettings The live settings for this feature, if your project has more than one.
OutlineRenderingMode EffectiveMode The mode actually used, which is not always the one you picked.
GraphicsFormat CameraTargetFormat The colour format the camera used. Together with EffectiveMode, this answers “why is my mode not the one I chose”.
int ActiveLayerMask One bit per layer that had something to outline.
bool ScissorActive, RectInt ScissorRect, RectInt ScissorComposeRect Whether the outline’s work was limited to part of the screen, and to which part.
ScissorCancelReason ScissorCancelReason Why it used the whole screen when it did.
bool MultilayerActive, int ChainPassCount Diagnostic detail about the last frame.
enum OutlineOcclusionMode { VisibleOnly, Always, OccludedOnly }
enum OutlineRenderingMode { Performance, Compatibility }
enum OutlineStage { Off, Tag, Convert, Dilate, Full } // debugging: stop the outline early
enum OutlineDebugView { None, Band, Interior, LayerId, RawMask, ComposedAlpha }
enum ScissorCancelReason { None, Disabled, NothingOnScreen, DebugView, Stereo, NearPlane, RectTooLarge }

Tools > Outline Zero > Validate Setup checks your project and offers one-click fixes for what it finds. It never changes anything unless you press a button.