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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.