unity – How to show / hide sprites using onMouseDown () in unity2d?

I am currently using unit for a school project and must be able to hide
connect sprites for "extensions". I looked for it all over the internet and seems to find no answer.

Here is the script so far

using System.Collections;
using Systems.Collections.Generic;
using UnityEngine;

[DisallowMultipleComponent]
public class addBlock: MonoBehaviour {

void OnMouseDown ()
{
Debug.log (gameObject.name);
}
}

if someone can help thanks for you help.

Collision Detection – How do I convert OnCollisionEnter2D to OnMouseDown?

I have created a simple animation.

I have a "Gamer" Object that I move and squares hit to destroy it

Squares that I have to destroy in the right order (1-2-3-4-5 etc.)

If I make a mistake, the animation ends.

I would like to change this code now. I would like to change OnCollisionEnter2D () on OnMouseDown (),

I want to delete the squares one at a time, but instead of using a collision, just click on the squares.

Can someone help you to convert this code?

This is my code on the "Gamer" Object:

                using System.Collections;
using System.Collections.Generic;
with UnityEngine;
using UnityEngine.SceneManagement;

Public Class Gamer: MonoBehaviour {

int index = 1;
public GameObject gameOverText, restartButton;

public GameObject WinningText, ExitButton, NextLevelButton;

public GameObject Manager;


void start () {
gameOverText.SetActive (false);
restartButton.SetActive (false);
Manager.SetActive (true);
WinningText.SetActive (false);
ExitButton.SetActive (false);
NextLevelButton.SetActive (false);
}
public void OnCollisionEnter2D (Collision2D column)
{
Debug.Log ("Player hit object:" + col.transform.name);
// Check if the object you hit is one of the "collision objects":
if (col.transform.GetComponent())
GetComponent().Play();
{
collisionObject colObj = col.transform.GetComponent();
if (! colObj) return;
if (index == colObj.myIndexNumber) {
if (colObj.isHighestNumber) {
Debug.Log ("Yes, you hit the last square correctly, you WIN!");
WinningText.SetActive (true);
NextLevelButton.SetActive (true);
ExitButton.SetActive (true);
gameObject.SetActive (false);
Manager.SetActive (false);
}
Destroy (col.ameObject);
Index ++;

}
// Here we know it does not match the number. :)
miscellaneous
gameOverText.SetActive (true);
restartButton.SetActive (true);
gameObject.SetActive (false);
Manager.SetActive (false);

}
}
}
}

And that is my code in the "Square" Object:

                                using System.Collections;
using System.Collections.Generic;
with UnityEngine;

public class collisionObject: MonoBehaviour {
public int myIndexNumber;
public bool isHighestNumber;
public void Start ()
{

isHighestNumber = true;
// Find all other objects:
foreach (collisionObject cObj in GameObject.FindObjectsOfType)()) {

// Check if one of the other objects has more than mine, if so, note that I'm not the highest number.
if (cObj.myIndexNumber> myIndexNumber) {
isHighestNumber = false;
break;
}
}
Debug.Log ("object number" + myIndexNumber + "is here // is the highest number:" + isHighestNumber);
}
}