Making UI elements affected by different lights

To give a professional touch to our user interface, we can add lights to it. This could be effective if we want to create a specific type of atmosphere or emphasize an element. In fact, Unity allows us to alter UI elements by light. In this recipe, you will learn how to create two UI elements and, using layers, how to have them affected by different lights. In order to do this, we will add two new layers, create a new UI material, and of course play with lights.

How to do it...

  1. We need to create two panels that are slightly separated, as shown in the following screenshot. From this, you can learn how to affect different UI elements with different lights. To create the panels, right-click on the Hierarchy ...

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.