UIPathRibbonTiled
Overview
MaskableGraphic that draws a tiled ribbon along a polyline. Accepts world-space points, converts them to local UI space, and tiles a repeat-wrapped texture along the length. Supports scrolling (phase animation), usage-based appearance (active/paused/building), and focus/unfocus alpha. Works in Screen Space - Overlay. fileciteturn22file0
Key Serialized Fields
BoolVariable paused- Texture & Material:
Texture2D tileTexture(wrap Repeat, not sprite-packed), optionalMaterial baseMaterial(cloned per instance) - Tiling & Look:
startingTileLength,halfWidth,phase,startingScrollSpeed - Path Colors:
baseColor,pausedColor,buildingColor,unselectedAlpha - Sampling:
samplesPer100px(polyline density) fileciteturn22file0
Public API
void SetPathWorld(Vector3 start, Vector3 end, Vector3 mid, int curvePoints);
// Builds a quadratic Bézier with control P1 = 2*mid - 0.5*(P0+P2).
void SetPath(RectTransform[] rects); // centers of rects in WORLD space
void SetPathUsage(int activeUsage, int inactiveUsage);
// totalUsage>0 enables; color=pausedColor when inactiveUsage>0 else baseColor;
// tileLength shortens with usage (capped at x3); scrolling only when activeUsage>0.
void SetFocusedAlpha(); // alpha = 1
void SetUnfocusedAlpha(); // alpha = unselectedAlpha
void SetPathBuilderUsage(); // buildingColor, default tiling, scrolling on
void RefreshFromWorld(); // force world→local rebuild next frame
Under the hood it keeps per-instance material (_MainTex_ST used for tiling/offset) and rebuilds geometry in OnPopulateMesh. Update() advances phase when not paused. fileciteturn22file0
Notes
- Duplicate-culled world points → local space → sampled strip (centers/normals).
- Changing anchors at runtime? Call
RefreshFromWorld()to resync. fileciteturn22file0