Rust.Community icon indicating copy to clipboard operation
Rust.Community copied to clipboard

Add 9-slice support for Images

Open Kulltero opened this issue 11 months ago • 0 comments

Slicing Serverside images

This PR only adds the ability to specify the border, not the Tilemode or Stretch properties Learn more about 9-slicing

The Breakdown

this PR allows us to specify a Slice property on the UnityEngine.UI.Image object to change how the image is displayed. paired with the existing imagetype field this lets us easily create borders, corner images and glows that scale to any size with just a single asset

Notes:

when setting a slice value it can only be done during instantiation, so any sprites using a slice value will not be cached. it could be reasonable to assume that a sprite will only ever be used with a single slice value (and therefore be cached), but the PR cannot make this assumption at the cost of breaking potential usecases where this isn't the case.

Kulltero avatar Feb 10 '25 13:02 Kulltero