Inverse 9-slice

Typical 9-slicing keeps the corners of the image the same size and scale all the other parts to match the dimensions of the image. I’m looking for a way to get opposite effect, where the central rectangle stays the same size and everything else scales.

My use case is an overlay that I want to use during a tutorial that darkens out the entire screen except for a particular area. I want this area to have a radial alpha gradient so that it works like a “spotlight” for the UI by darkening everything else.

I know I can make this with a handful of different images (one for the radial gradient and four for blocking out the rest of the screen), but I’m worried about visible gaps or overlaps between the images, especially when they are being animated and scaled.

An “inverse” 9-slice would be perfect for this application but I don’t know whether that can be done without official support.

If it’s a ‘spotlight’ as you mention, then you could try simply scaling the plane but not the texture, whilst the texture wrap mode could be set to clamp. This would repeat the edge pixels (black?) no matter how large you scale the plane.

http://ericeastwood.com/blog/20/texture-tiling-based-on-object-sizescale-in-unity