Skip to main content

Fill Texture Filter Component

Component Screenshot

Overview​

This component can fill a UI element with a texture, with various fit, transform, tiling and blend options.

WebGL Demo​

Properties​

Component Screenshot

Property                            Type    Range    DefaultDescription
Fill
    TextureTextureThe 2D texture to fill with.
    Wrap ModeEnumDefaultThe texture coordinate wrap mode to use for tiling the texture. Options are:
• Default: Use the wrap mode specified in the original texture.
• Clamp: Texture coordinate are clamped to [0..1] meaning the texture can not tile.
• Repeat: The texture coordinates repeat infinity producing a repeating tile pattern.
• Mirror: The texture coordinates repeat with the tiling direction alternating after each repeat.
    ColorColorWhiteThe color of the tint the texture. The texture color is multiplied by this color.
Area
    Fill SpaceEnumGeometryOptions are:
• Geometry: The gradient position is relative to the Graphic geometry.
• Screen: The gradient position is relative to screen-space.
    Fixed Scale ModeBoolTrueIf true, the texture maintains aspect ratio and fills the area based on it's size, otherwise it scales the texture based on the Scale Mode property.
    Scale ModeEnumScale To FitThe fit mode to use which applies an initial scaling to the texture coordinates to describe how the texture should fit into the rectangular area of Graphic to fill. Options are:
• Stretch To Fill: Stretches the texture to fill the complete rectangle. The texture will not maintain aspect ratio.
• Scale And Crop: Scales the texture, maintaining aspect ratio, so it completely covers the rectangle area. If the texture is being draw to a rectangle with a different aspect ratio than the original, the image is cropped.
• Scale To Fit: Scales the texture, maintaining aspect ratio, so it completely fits withing the rectangle area.
Transform
    PivotEnumMiddleCenterThe point in the rectangle where scale and rotation is centered.
    ScaleFloat[0..32]1.0Scale the texture coordinate to create a zoom in or zoom out effect.
    RotateFloat[0..360]0.0Rotate the texture coordinates.
    OffsetVector20, 0Offset the texture coordinates to translate the texture.
Animation
    Scroll Delta TimeEnumNormalThe time delta to use when updating scrolling. Options are:
• Normal: Use Time.deltaTime.
• Unscaled: Use Time.unscaledDeltaTime, but use Time.captureDeltaTime if it is set.
    Scroll SpeedVector30, 0, 0Set an animation speed. XY corresponds to the texture offset (in pixels per second), and Z corresponds to rotation.
Apply
    Source AlphaFloat[0..1]1.0Fades the source Graphic.
    Blend ModeEnumBlendThe blending mode to apply the gradient to the original Graphic. Options are:
• Replace
• Blend
• Over
• Under
• Mask
• Clear
• Darken
• Multiply
• Color Burn
• Linear Burn
• Lighten
• Screen
• Color Dodge
• Linear Dodge
• Overlay
• Soft Light
• Hard Light
• Vivid Light
• Linear Light
• Pin Light
• Hard Mix
• Difference
• Exclusive
• Subtract
• Divide
    Blend Mode Force Gamma SpaceBoolFalseWhether to force blend operations in happen gamma-space to match the default in software such as PhotoShop. Otherwise blend operations happen in the active color-space.
    StrengthFloat[0..1]1.0Strength of the effect.
    Render SpaceEnumCanvasWhich coordinate system use when rendering this filter. Options are:
• Canvas: Render the filter before any transforms (scale/rotation/translation etc) are applied.
• Screen: Render the filter after transforms have been applied.
Read more about this property here.

Usage​

Add this component to any GameObject that contains a UI Graphic component (eg Text, Image, RawImage, etc). The object will now render with a shadow.

Usage with TextMeshPro​

To use this filter effect with TextMeshPro - Text (UI) use the Filter Stack (TextMeshPro) component.