Using Gradients and Inline Style Changes

You can use the Gradients textures to create much higher quality gradients in 2D Toolkit. In addition to that, 2D Toolkit also supports inline style changes - changing gradient from within one textmesh.

  1. Add a gradient to the TutorialFont created here.


    This is the gradient file used in this example.


  2. Set up the number of gradient tiles. In this example, our gradient image has 8 tiles.


  3. Click commit. Any TextMeshes using this font will now use gradients.


  4. Create a TextMesh in the scene and pick the TutorialFont. You will now be able to select gradients in addition to tinting the TextMesh using colors.


  5. Tick the *Inline Styling * tick-box in the TextMesh inspector. You can use inline style changes to pick from the first 10 gradients. For example, you can enter Hello, ^1World ^2!!! and this will style the string as shown below.

    Note: The default style is the gradient which is selected in the interface.


    You can do this from scripts too, making this very powerful indeed.