Making an animated 3D UI warning
Warnings in games can be provided in many ways, for doing both the right and wrong things. However, having the option of 3D capabilities allows us to create more interesting and dynamic warning messages.
How to do it...
- To begin, let's create our warning in the UI. We can start by adding a panel. Right-click on the Hierarchy panel, then go to UI | Panel and rename it as 3DWarning. We can continue to add other UI elements, so we want a title inside another panel to evidence it and maybe add some text. As best practice, every time you add a component, tweak its anchor points as well so that everything can scale properly. At the end, we should have something that looks like this:
- Now, we should take advantage of the third dimension and adjust the value of the z axis for the components in the foreground. We can adjust it incrementally, similar to what we did in the first recipe of this chapter - Creating a 3D menu. At the end, we should see something like...