Adding in Score/High score
Now that the game has the start and ending, let's make it so that we can gain a score whenever we hit a duck:
From the Hierarchy tab, duplicate the
Time Text
object and rename it toScore Text
. Go to the Rect Transform's Anchor Presets menu, hold down Alt + Shift, and click on the top-left option. Then, change Pos X to 10 and Pos Y to -10 to push it a bit off from the edge of the screen.Then, in the Text component, change the Horizontal alignment to the left and change the Text to Score 0.
Finally, change the
Outline
component's Effect Distance to1.5
,-1.5
:Next, we will want to duplicate the Score Text object and rename it High Score Text. From there, open up the Anchor Presets menu, hold down Alt + Shift, and click on the top-right option. Afterwards, change Pos X to -10 and Pos Y to -10.
Afterwards, in the Text component, change the Text to High Score 0. Then, change the Alignment to the right side:
Now that we have the objects created, let's add in the functionality...