title: How to make button image change with on click anywhere on screen?
body: <p>I am very new to Unity and I have trouble understanding on click possibilities with my UI buttons etc.. In my project, I have a button which changes its image whenever I click on it and the way I made it is: I created this script: </p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  
  [RequireComponent(typeof(Button))]
  
  public class OnClickScript : MonoBehaviour
  {
      public static int spritenumber=1;
      public Button mybutton;
      public Sprite square;
      public Sprite circle;
      public Sprite triangle;
      public int counter = 1;
  
      void Start()
      {
          mybutton = GetComponent&lt;Button&gt;();
  
  
      }
  
      public void changeButton()
      {
          if (PAUSESCRIPTE.isPaused == false)
          {
              counter++;
              if (counter == 1)
              {
                  mybutton.image.overrideSprite = square;
                  spritenumber = 1;
                  soundmanagerscript.PlaySound("buttonpress");
  
  
  
              }
              if (counter == 2)
              {
                  mybutton.image.overrideSprite = circle;
                  spritenumber = 2;
                  soundmanagerscript.PlaySound("buttonpress");
  
              }
              if (counter == 3)
              {
                  mybutton.image.overrideSprite = triangle;
                  spritenumber = 3;
                  counter = counter - 3;
                  soundmanagerscript.PlaySound("buttonpress");
              }
          }
  
      }
  }
  </code></pre>
  
  <p>I attached this script to my button, selected sprites which I want to use and I added on On Click() function to the button.</p>
  
  <p>Afterwards I decided that I no longer want to change the sprite of my button by clicking on the button itself but rather by clicking anywhere on the screen. I tried using Input.GetMouseButtonDown(0) but got no results since I used it incorrectly. Any help on, how to achieve what I want, is very welcome. Thanks in advance.</p>