Creating an outline on an object for onmousedown

How could I do this? Do I need to purchase something from the asset store? I know how to highlight the whole object using the monobehavior.onmouseover() documentation but I am just trying to outline the border of it when the mouse button is clicked. Thank you!

Hello,

I believe that you are looking for something like in this video:
How to make a 2D OUTLINE in Unity! - YouTube

If it is, then set its thickness to zero. Then, inside MouseOver function, you should set thickness a decent number. Keep in mind that MouseOver function detects the objects only with collider.

How would I go towards approaching this?

  • Complete the steps in the video. Play with the slider and see the outcome.
  • Add your character collider (2D).
  • Create a script and attach the character. It should outline the following:
public class outline : monobehaviour
{
   private Material mat;

   void Start
   {
       mat = GetComponent<SpriteRenderer>.material.
   }

  void OnMouseDown()
  {
      mat.SetFloat("Vector1_SA....", 0.05)
     //What is this crazy name? Because he defines thickness value 's reference as this is (Check Sprite Outline Panel inside Shader Graph). You may simplify the name.
    //Why 0.05? Because he sets the max value of slider 0.05
  }

  void OnMouseUpAsButton() // or simply OnMouseUp()
  {
        mat.SetFloat"Vector1_SA....", 0)
  }
}

So, this is supposed to outline the character when you pressed on it. It should go back to usual, when you release the button.