To create a digital clock, follow these steps:
- Create a new Unity 2D project.
- Import the provided Fonts folder, as described in the Getting ready section. Copy these font files into your Unity project – they need to be in your Assets folder.
- In the Hierarchy window, add a UI Text GameObject to the scene named Text-clock.
- Ensure that the Text-clock GameObject is selected in the Hierarchy window. Now, in the Inspector window, ensure that the following properties are set:
-
- Font Type set to Xolonium Bold
- Font Size set to 20
- Alignment set to horizontal and vertical-center
- Horizontal and Vertical Overflow settings set to Overflow
- Color set to white
- In Rect Transform, click on the Anchor Presets square icon, which will result in the appearance of several rows and columns of preset position squares. Hold down Shift + Alt and click on the top and center column rows.
- In the Project window, create a folder named _Scripts...