My gameobjects keep changing layers

I have lots of prefabs gameObjects and I Instantiate them in a parent gameObject. When the user clicks one object, the prefab destroy. I have 48 of this prefabs in the scene. But when I click one object, the other ones keep moving back and forth, like changing layers or something. One or two seem to disappear but that object just move behind others.

Here is some of the code that I’m using:

this is how I instantiate the prefabs in my gameObject parent:

public GameObject[] prefabs;
private GameObject temporalPrefabs;

int index = Random.Range(0, 20);
temporalPrefabs= Instantiate(prefabs[index], transform.position, transform.rotation) as GameObject;
temporalPrefabs.transform.parent = transform;

and this is how I destroy the clicked object (this code is added as component in each prefab)

void OnMouseDown()
    {
      Destroy(gameObject);
    }

if some one please know what could be happening and how can I fix this I’ll be really thankful.

Your code does not provide enought information. Try to Understand what’s going on. Add a Debug Log on your prefab’s Start and Destroy. You can use a less count of prefabs to test and provide a name to each prefab with it’s index. You can Debug.log for a specific prefab by checking it’s name. If you add a specific log to Update function you could check your object’s lifetime and position.
Destroy function remove object with some delay. Try to Use DestroyImmediate instead. It could be this case.