Adding shadows to text

In this recipe, you will learn how to add a shadow to a Text (Script) component. In order to achieve this, you will learn how to use a UI Effect component of the new UI system of Unity — the Shadow (Script) component. This kind of effect can add a dramatic touch to text and, as a result, make it stand out among other elements that may be in the UI. In addition to this, when there are many elements in the background, it is possible that a piece of text may seem lost. As such, adding a shadow to the text can also improve its legibility.

How to do it...

  1. First of all, we need to create a new UI text. To do this, right-click on the Hierarchy panel and then navigate to UI | Panel. Finally, rename it Text with Shadow.
  2. Then, we can ...

Get Unity UI Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.