Shape Foundry
Scripting reference
Runtime types use the ShapeFoundry namespace. Shape Image inherits from MaskableGraphic; common UI members such as color, rectTransform, raycastTarget and maskable are available.
Edit one shape
Settings returns the resolved appearance as a value. Change that copy, then pass it to SetLocalSettings. Changing the copy alone does not update the component.
using ShapeFoundry;
using UnityEngine;
public class PanelAppearance : MonoBehaviour
{
[SerializeField] ShapeImage image;
public void SetRadius(float radius)
{
var settings = image.Settings;
settings.corners = Vector4.one * Mathf.Max(0, radius);
image.SetLocalSettings(settings);
}
}Corner order is top-left, top-right, bottom-right, bottom-left. ShapeKind selects RoundedRectangle, Ellipse, Ring or Polygon. ShapeGradient selects Solid, Linear, Radial or Angular. ShapeFillMode selects Automatic, Horizontal, Vertical or Radial.
Assign the example's Image reference in the Inspector before calling SetRadius.
SetLocalSettings makes all appearance sections local by default. Its overload accepts a ShapeOverrides mask when you want to retain selected sections of a linked style. Use FillAmount for frequently updated progress without replacing the full appearance.
Shared styles
Assign a ShapeStyle with ShapeImage.SetStyle(style). The read-only Style property returns its current link. ShapeStyle.Settings returns a value too; call ShapeStyle.SetSettings after editing it. Linked shapes receive the change. Reapplying identical settings does not notify them.
Use ShapeImage.SetOverrides(mask) to select local sections: Geometry, Fill, Border, Shadow or Progress. The read-only Overrides property returns the mask. Reset an override in the Inspector to restore that section from its shared style. DetachStyle() retains the resolved appearance and removes the style link.
Artwork
SourceImage accepts a Sprite, Texture2D, 2D RenderTexture or null. Useful properties are:
ImageScale: Stretch, Fit, Cover or Tile.TintImage: multiply the source by the fill colour or gradient.ShadowFollowsImageandBorderFollowsImage: use alpha contours for the relevant effect.TileSize: repeat dimensions in RectTransform units; zero axes use automatic sizing.TileOffset: pattern offset in RectTransform units.DefaultTileSize,NativeTileSize,EffectiveTileSize: automatic, native and effective repeat dimensions.SetNativeSize(): resize the RectTransform to the source's native dimensions.
Artwork is separate from a shared appearance. Restyling keeps the source and its sizing settings.
Progress and controls
ShapeProgress animates a Shape Image's fill amount. Call SetValue(float) for an animated transition or SetValueImmediate(float) to jump. Values are clamped to 0..1. Duration and UnscaledTime control the transition. A Slider's onValueChanged event can call SetValue directly.
ShapeSlideToggle extends Unity Toggle. Use isOn, onValueChanged and SetIsOnWithoutNotify as usual. OnColour, OffColour and ThumbColour set its colours. Dragging and keyboard navigation use the native event system.
ShapeButton extends Unity Button. Click events and navigation use the normal Button APIs. A ShapeButtonStyle shares feedback colours, scales and duration. Use Color Tint transitions for its colours; assign the FeedbackStyle property to refresh an assigned profile immediately at runtime.
Input and dropdown templates use TMP_InputField and TMP_Dropdown. Scroll views use ScrollRect. The standard checkbox uses Unity Toggle and ShapeCheckmark.
Rendering costs
Untextured shapes and raw textures use a single quad when no extra artwork layer is needed. Sprites use their cached triangles and UVs. Borders and filtered artwork shadows can add a background quad; a hard image shadow adds shifted image geometry.
Matching active appearances share materials. Different textures, appearances, masks and artwork-effect fields can split batches. There is no guarantee that arbitrary unique styles render in one draw call. Large transparent shapes and shadows add overdraw.
Image-aware borders and filtered shadows share cached GPU fields when their source, geometry and effect settings match. A field is capped at 512 pixels on its longest edge. Changing its silhouette, progress or effect dimensions rebuilds it; colour changes can reuse it. Live RenderTextures update the effect each frame. Preview and runtime caches are separate.
Use the ShapeFoundry.RebuildMesh and ShapeFoundry.BuildArtworkEffects Profiler markers to inspect geometry and artwork-effect work. Profile native Canvas batches, GPU time and allocations on the devices you intend to support. Inspector previews reuse GPU textures; library thumbnails are queued and cached, and new thumbnail rendering pauses during Play mode.
Compatibility notes
Do not assign a Shape Image to an Image-typed field: it inherits from MaskableGraphic. Use Graphic or ShapeImage where appropriate. Code using Image-specific features and Image animation bindings needs adaptation.
Sprite nine-slicing, per-pixel alpha raycasts and 3D RenderTexture sources are not supported. Filtered artwork effects require floating-point render textures; unsupported hardware uses procedural effects instead. Parent UI masks clip both the image and its shadow.