Currently, only our button's color changes on mouse hover. We also want a smooth scale tween to make our button bigger to make the change more obvious. Good news: NGUI has a component for that.
The UIButton Scale
component can trigger upscale or downscale animations on mouse hover or on press. Even though it is called UIButton Scale
, it can work with any other non-button 2D or 3D GameObject matching these three conditions:
It must have
UIButton Scale
attached.It must have a trigger
Collider
attached: box, capsule, sphere, and so on.It must reside on a layer included in the
Event
Mask
ofUICamera.
Now, let's see how it's used.
Let's add the UIButton Scale
component to all three of our main menu buttons: