Summary

In this chapter, you learned how to create a 3D UI root. We saw how to calibrate the 3D UI's scale to match the screen's pixel size.

We created a 3D score counter that scales up before it increases gradually towards the new score value. Anchors were used to make sure it is visible in most common screen sizes and aspect ratios.

A specific 3D pause menu was created with an interaction override collider to avoid interactions with the game while it's paused, using Time.timeScale = 0.

You also learned that NGUI widgets can be displayed within the 3D environment if these simple conditions are met:

  • At least one of its parents has the UIPanel component attached to it
  • The widget lies within the main camera's layer mask, usually in Default

We used this technique to add the current level's name in the environment.

Lighting effects were added to the level's name label and background. In order for them to react to lights, we needed to enable the Normals option on the parent UIPanel, and also make sure we used Refractive Atlas, which contains the normal and specular maps.

We can now launch our game from the Menu scene, and freely launch the game, pause it, and come back to the main menu without any problem.

Now that we know how to create 3D UI and add lighting effects, we can move on to Chapter 8, Going Mobile, and talk about how we can handle mobile devices.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.171.212