title: Changing the image of long clicked Sprite
body: <p>I am trying to change the image of a sprite that's had a long click on it.</p>
  <p>My below code works except in the LongPress method it changes the image of all sprites that have this script assigned as an inspector component. Additionally, the code triggers after long clicking anywhere onscreen, not isolating itself to just the sprites with the script assinged</p>
  <p>OnMouseDownAsButton would solve a lot of the issues, however wrapping bits of my code in an OnMouseDownAsButton function to isolate the colliders seems to cancel out the update() method.</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.Events;
  
  public class LongClickButton : MonoBehaviour
  
  {
  public Sprite flagTexture;
  public Sprite defaulttexture;
  
  public float ClickDuration = 2;
  public UnityEvent OnLongClick;
  
  bool clicking = false;
  float totalDownTime = 0;
  
  void Update()
  {
      if (Input.GetMouseButtonDown(0))
      {
          totalDownTime = 0;
          clicking = true;
      }
  
      if (clicking &amp;&amp; Input.GetMouseButton(0))
      {
          totalDownTime += Time.deltaTime;
          if (totalDownTime &gt;= ClickDuration)
          {
              clicking = false;
              OnLongClick.Invoke();
          }
      }
      if (clicking &amp;&amp; Input.GetMouseButtonUp(0))
      {
          clicking = false;
      }
  }
  
  public void LongPress()
  {    
      if (GetComponent&lt;SpriteRenderer&gt;().sprite == flagTexture)
      {
          GetComponent&lt;SpriteRenderer&gt;().sprite = defaulttexture;
      }
      else if(GetComponent&lt;SpriteRenderer&gt;().sprite == defaulttexture)
          GetComponent&lt;SpriteRenderer&gt;().sprite = flagTexture;
      }
      }
  </code></pre>