How to add multiple image sprite in Button UI?

I have button with image sprite. I want to add additional image sprite (tick mark) to show it is selected. That means i want to add tick.png image file on the top of the button existing image.

Is this possible and how? Thanks in advance.

That does not sound like a button, it seems to be a toggle. Try it out, I think it does exactly what you want by default.

If that’s not your use case, you will still need to add a child game object and an Image component to it. The rest you would need to program. But first try a toggle component.

I have solved the issue with alternative approach presented by @Harinezumi . Both answers are equally acceptable. Thanks both (@Harinezumi and @fafase) of you.

Unity uses the order in hierarchy to define what shows on top.

In your case, you’d want the tick on top of the image so your hierarchy should be as such:

- Canvas
    - ImageFrame (with Image and Button components)
          - TickImage (Image component)

And the script will take care of it. Drag the OnClickListener method into the button onClick event slot.

public class ButtonController : MonoBehaviour
{
     [SerializedField] private Image tick = null;
     void Start()
     {
           this.tick.SetActive(false);
     }
     public void OnClickListener()
     {
             this.tick.SetActive(!this.tick.activeSelf)
     }
}

EDIT AFTER COMMENT.

The tick should only be on one item:

public class ButtonController : MonoBehaviour
{
     [SerializedField] private Image tick = null;
     static event Action RaiseClick;
     void Start()
     {
           this.tick.SetActive(false);
           RaiseClick += HandleClick;
     }
     void OnDestroy(){ RaiseClick -= HandleClick; } 
     public void OnClickListener()
     {
              HandleClick();
             this.tick.SetActive(!this.tick.activeSelf);
     }
     void HandleClick(){ this.tick.SetActive(false); }
}

There is now a static event, all button are listening to it. On click the event is raised and all listeners will set themselves to false. Next, the caller sets himself to true.