We are now ready to build our galleries. To do so, take the following steps:
- Select the Gallery GameObject and add a child object by right-clicking and choosing UI | Text.
This will create a new text object within our Gallery object. Adjust the text object's attributes as follows:- Rename the object CategoryTitle.
- Set the Y position to 252 in the Rect Transform component.
- Replace the New Text text in the Text (Script) component to Category Title. It should be noted that this text is a placeholder and the actual title will be set using a script.
- In the Character section, choose a Font and Font Style to your liking.
- Set the Horizontal and Vertical Overflow to Overflow under Paragraph. The Default value, Wrap, will attempt to display the category name within the Text space. Changing this value now will make it easier to determine the necessary font size.
- Set the Font Size to 60 or a size appropriate for your text.
If the Horizontal Overflow and Vertical Overflow values are set to Wrap when choosing a font size, the text will momentarily vanish. This is because the resized text is larger than the text field which will truncate the content.
A good strategy for determining the correct font size is to enter the longest text string into each of the Text (Script) fields. This method will make it easier to judge the line lengths and negative space between the canvases. You will probably need to adjust this value a few times, but starting with this strategy should help find the correct size:
- Set the Paragraph Alignment to Center and Middle.
- Finally set a color, which works for your scene. In this example, we are setting the category title to 60-point ClearSans-Bold, with a normal style and white color.