UI.Button
In order for the button script to be added to it's GameObject during import, you need to add the "btn" tag to the beginning of its name in Figma.
If you use the "Unity Button" without states (def, pres etc.), and you want the "Color Tint" animation to be applied to the button (changing color when pressed), the button must be assigned a "Target Graphic" - usually an image that is the background of the button. In order for the "Target Graphic" to be assigned automatically during import, the image that is the background of the button must be at the end of the hierarchy of its child objects.

For each of supported button assets, you can specify special behavior for states "pressed", "hovered", "disabled" (and "selected" for "Unity Button"). For this, you need to assign special tags to the button's child components.
Special tags:
def - default button state, used when nothing happens to the button;
pres - used when a button is clicked;
hov - used when hovering over a button;
dis - used when a button is disabled (when it cannot be clicked).
Please take a look at the scheme showing how objects with tags are assigned to the button component.

As you can see, the component with the "def" tag is recognized as TargetGraphic, and from the other components with state tags, only the color is taken, which will then be assigned to the component with the "def" tag in Unity.
When the button is in ColorTint mode, child objects of the button with tags "hov", "pres", "sel", "dis" are removed from the scene.
If your TargetGraphic component cannot be recreated on the scene using Unity's means or with procedural assets, it will be downloaded, and the button transition type will be switched to SpriteSwap mode. In SpriteSwap mode, child image objects of the button are not removed, regardless of the tag.
Last updated