Overview
Texture Macros are procedural texture expressions that can be used anywhere a texture file path is accepted (i.e. the src field of a Texture2D property). They generate a texture at load time without needing an image file on disk.
Macros were originally added for quick testing but have proven genuinely useful in production — for example, a solid metallic-smoothness map, a flat normal, or a simple gradient can all be expressed in a few characters rather than shipping an extra PNG.
Syntax
@NAME
@NAME(arg1,arg2,...)
@NAME(arg1,arg2,...)[width,height]
- The
@prefix is required. - Arguments and size are both optional — when omitted, sensible defaults are used (see each macro).
- Default size is
4×4pixels. Larger sizes rarely improve quality for solid-color macros, but may matter for gradients or checkerboards. - Size values must be positive integers.
- The macro name is case-insensitive (
@white,@WHITE, and@Whiteare all the same).
Import Options
When a macro is used as the src of a Texture2D property, import options are inferred from the slot name using the same logic as file-based textures. You can override this by setting the options field on the property explicitly — see the Material Target page.
Quick Reference
| Macro | Signature | Notes |
|---|---|---|
@WHITE | @WHITE[w,h] | |
@BLACK | @BLACK[w,h] | |
@TRANSPARENT | @TRANSPARENT[w,h] | |
@NORMAL | @NORMAL[w,h] | Flat normal (0.5, 0.5, 1, 1) |
@GREY | @GREY(value)[w,h] | value: 0 - 255 |
@RGBA | @RGBA(r,g,b,a)[w,h] | channels: 0 - 1 |
@RGBA32 | @RGBA32(r,g,b,a)[w,h] | channels: 0 - 255 |
@HSL | @HSL(h,s,l)[w,h] | h: 0 - 360, s/l: 0 - 100 |
@METALLIC_SMOOTHNESS | @METALLIC_SMOOTHNESS(metallic,smoothness)[w,h] | metallic/smoothness: 0 - 1 |
@CHECKER | @CHECKER(r1,g1,b1,a1,r2,g2,b2,a2,cells)[w,h] | |
@GRADIENT_H | @GRADIENT_H(r1,g1,b1,a1,r2,g2,b2,a2)[w,h] | left → right |
@GRADIENT_V | @GRADIENT_V(r1,g1,b1,a1,r2,g2,b2,a2)[w,h] | bottom → top |
Size ([w,h]) is optional on all macros; defaults to 4×4.
Macro Reference
Solid Color
These macros take no arguments and produce a uniform solid texture.
| Macro | Pixel value | Description |
|---|---|---|
@WHITE | (1, 1, 1, 1) | Solid white |
@BLACK | (0, 0, 0, 1) | Solid black |
@TRANSPARENT | (0, 0, 0, 0) | Fully transparent |
@NORMAL | (0.5, 0.5, 1, 1) | Default flat normal map |
"src": "@NORMAL"
"src": "@WHITE[1,1]"
@GREY
Solid grey texture. value is in the 0–255 range. Defaults to 128 (mid-grey) when omitted.
Signature
@GREY(value)
| Param | Range | Description |
|---|---|---|
value | 0 - 255 | Brightness level |
Example
"src": "@GREY(200)"
@RGBA
Solid color with channels in the 0–1 range (floating-point).
Signature
@RGBA(r,g,b,a)
| Param | Range | Description |
|---|---|---|
r | 0 - 1 | Red |
g | 0 - 1 | Green |
b | 0 - 1 | Blue |
a | 0 - 1 | Alpha |
Example
"src": "@RGBA(1,0.2,0.2,1)" // semi-transparent red
"src": "@RGBA(0,0,0,0.5)" // 50% transparent black
@RGBA32
Solid color with channels in the 0–255 integer range. Otherwise identical to @RGBA.
Signature
@RGBA32(r,g,b,a)
| Param | Range | Description |
|---|---|---|
r | 0 - 255 | Red |
g | 0 - 255 | Green |
b | 0 - 255 | Blue |
a | 0 - 255 | Alpha |
Example
"src": "@RGBA32(255,51,51,255)" // same red as above
@HSL
Solid color specified in HSL. Converted to RGBA internally.
Signature
@HSL(h,s,l)
| Param | Range | Description |
|---|---|---|
h | 0 - 360 | Hue (degrees) |
s | 0 - 100 | Saturation (%) |
l | 0 - 100 | Lightness (%) |
Example
"src": "@HSL(210,80,40)" // dark blue
"src": "@HSL(0,0,50)" // neutral mid-grey
@METALLIC_SMOOTHNESS
Produces a metallic-smoothness map compatible with the standard Unity HDRP/Lit packing: R = metallic, G = smoothness, B = 0, A = 1. Both parameters are in the 0–1 range.
Signature
@METALLIC_SMOOTHNESS(metallic,smoothness)
| Param | Range | Description |
|---|---|---|
metallic | 0 - 1 | Metallic value |
smoothness | 0 - 1 | Smoothness value |
Example
"src": "@METALLIC_SMOOTHNESS(0.9,0.5)"
@CHECKER
Checkerboard pattern alternating between two RGBA colors. All color channels are 0–1. The cells argument controls how many checker cells appear across the texture. All arguments are optional and default to white/black with 2 cells.
Signature
@CHECKER(r1,g1,b1,a1, r2,g2,b2,a2, cells)
| Param | Range | Default | Description |
|---|---|---|---|
r1,g1,b1,a1 | 0 - 1 each | white | First color |
r2,g2,b2,a2 | 0 - 1 each | black | Second color |
cells | ≥ 1 | 2 | Number of checker divisions across each axis |
Example
"src": "@CHECKER(1,0,0,1, 0,0,1,1, 4)[64,64]" // red/blue 4×4 checker, 64px
"src": "@CHECKER" // default white/black 2×2 checker
@GRADIENT_H
Horizontal gradient (left → right) linearly interpolated between two RGBA colors. Channels are 0 - 1. Defaults to black → white when arguments are omitted.
Signature
@GRADIENT_H(r1,g1,b1,a1, r2,g2,b2,a2)
| Param | Range | Default | Description |
|---|---|---|---|
r1,g1,b1,a1 | 0 - 1 each | white | Left color |
r2,g2,b2,a2 | 0 - 1 each | black | Right color |
Example
"src": "@GRADIENT_H(0,0,0,1, 1,1,1,1)[256,4]" // black to white, horizontal
@GRADIENT_V
Vertical gradient (bottom → top). Same arguments as @GRADIENT_H.
Signature
@GRADIENT_V(r1,g1,b1,a1, r2,g2,b2,a2)
| Param | Range | Default | Description |
|---|---|---|---|
r1,g1,b1,a1 | 0 - 1 each | white | Bottom color |
r2,g2,b2,a2 | 0 - 1 each | black | Top color |
Example
"src": "@GRADIENT_V(0,0,0,1, 0,0.5,1,1)[4,256]" // black to blue, vertical