跳至主要内容

Filter Stack (TextMeshPro) Component

Overview

This component allows the TextMeshPro - Text (UI) component to be rendered with multiple filter effects (eg Drop Shadow, Outline etc).

WebGL Demo

Properties

Component Screenshot

Property                            Type    Range    DefaultDescription
Apply To SpritesBoolTrueWhether to apply the filters to sprites.
Relative To Transform ScaleBoolFalseWhether to scale the filters relative to the trasnform scale. This only uses the the X component of the transform scale and so is only useful for scale that affects all 3 axes. When this is disabled the size values for filters (eg Size in the blur filter) will be in pixels, but with this enabled the pixel sizes will be scaled too.
Relative Font SizeFloat0.0The font size to use as a refernce when applying scaling to pixel effects relative to the font size. Setting this to zero will disable scaling based on font size.
Update On TransformBoolTrueWhen this is disabled any transformation (translation, rotation, scaling) will not cause the filter to re-render. This can improve performance as in many cases re-rendering is not necessary.
FiltersListA list of image filters to apply, all deriving from the FilterBase class. The order can be changed by dragging the filters.

Setup

To use this component with TextMeshPro you first need to have the support for TextMeshPro enabled:

  1. Make sure TextMeshPro package is added to your project
  2. Go to the Edit > Project Preferences window and open the UIFX options, enabled TextMeshPro Support and press the Apply Changes button.

    screenshot
  3. Wait for the scripts to reload
  4. Close the Preferences window

Usage

Add this component to any GameObject that contains a UI TextMeshPro - Text (UI) component, then add your filter components (eg Drop Shadow, Outline) and assign them to the Filters list property.