Pixel Sprite Outline — real-time outline effect
Pixel-perfect sprite outline for 2D & pixel art. One component, zero setup. Customizable color, thickness, and edge detection.
by kuburi
Price History +
Sprite Outline adds a crisp, pixel-perfect outline to any SpriteRenderer using just a single component. Designed specifically for pixel art and 2D sprites, it respects hard pixel edges and delivers clean outlines at any resolution.
No material editing. No shader graphs. No post-processing.
Just go to Add Component > Effects > Sprite Outline, and it works instantly on any sprite!
✨ Features
- Zero Setup: Attach the component, and the outline appears immediately.
- Pixel-Perfect Edge Detection: Works beautifully with pixel art sprites.
- Adjustable Thickness: Fine-tune outline thickness from 0 to 16 pixels.
- Full Color Control: Pick any outline color via the Inspector or runtime API.
- Alpha Threshold: Adjust which sprite edges get outlined (great for anti-aliased sprites).
- Sorting Offset: Renders cleanly behind the sprite with zero z-fighting.
- Animation-Ready: Fully compatible with Unity Animator, sprite swapping, and flipping.
- Pipeline Agnostic: Seamlessly supports Built-in, URP, and HDRP.
- Runtime API: Control SetOutlineColor, outlinePixels, and more directly from your code.
⚙️ How it works
The component creates a lightweight overlay mesh behind your sprite and uses an edge-detection shader that samples 8 neighboring pixels. Only the edges are colored—the original sprite remains completely untouched. The result is a clean outline that flawlessly follows your sprite through animations, scaling, rotation, and flipping.
🚀 Performance
- Highly Optimized: Only 1 extra draw call per outlined sprite.
- Lightweight: Just 4 vertices per outline mesh.
- No Overhead: Zero render textures, command buffers, or post-processing passes required.
🎨 Customization (Inspector Properties)
- Outline Color: Choose any color.
- Outline Pixels: Set thickness (0 to 16).
- Alpha Threshold: Define which alpha values count as an edge (0.0 to 1.0).
- Sorting Order Offset: Adjust the render position relative to the base sprite.
🎯 Suitable for
- Pixel Art Games: Platformers, RPGs, and action games.
- Highlighting Elements: Interactable objects, enemies, items, or selected units.
- Visual Feedback: Hover effects, selection outlines, and targeting indicators.
- Any 2D Project: A versatile effect that works with any sprite texture.
📦 What's included
- SpriteOutlineRenderer.cs (Main component)
- SpriteOutlineOnly.shader (Edge-detection shader)
- Interactive demo scene with UI controls
- Demo character sprites (CC-0 licensed)
- Comprehensive documentation (PDF, HTML, and Markdown)
📌 Requirements
- Unity 2022.3 or later
- Compatible with Built-in, URP, and HDRP
- No additional packages required!