Game Development Reference
In-Depth Information
3.
Select the
Button
in the project hierarchy and open the
Animation
window
(navigating to
Menu
|
Window
|
Animation
); if you open the
Clips
dropdown, you should see there are four clips, one for each Button state.
4.
Select the
Highlighted
clip and ensure the
Record
button is pressed
(a red line should appear in the window and the
Play
controls at the top
of the editor should turn red (be warned, anything you change now will
be added to the animation!)
5.
Change the
Source Image
of the button's image control to one from the
yellow spritesheet (remember as we switched from the
Sprite Swap
to
Animation
mode, any options you had previously now no longer apply).
You don't need to set an animation position as it will automatically
blend from the button's previous state.
6.
Additionally, set the
Preferred Height
in the
Layout Element
component
of the Button to
100
to stretch the Button.
With the new UI system, it's always better to control/alter the native
sizes of a control rather than scale it; this allows the UI system to do
the magic for us. Since the button is in a layout group, we cannot alter
its size directly, which is why we are using the
Layout Element
and
Content Size Fitter
to our advantage. You can use scale if you wish,
there is nothing stopping you if that's how you roll.