Destroy Object with the same name

Good Evening,
I was wondering if it’s possible delete the object with the same name,I’ve found this solution but it works with tag.

public void DestroyAllOther(){
        GameObject[] others = GameObject.FindGameObjectsWithTag("Piatta"); //Get array of
        //all possible objects with a given tag.
        foreach (GameObject go in others){ //Get all of those objects so we can check them..
            //As long as the gameObject we're checking isn't ours..
            Destroy(go);
        }
    }

There’s no direct way to find all all objects with a name… only 1. Mainly because it’s not performant.

Instead you’ll have to loop over all GameObjects (Object.FindObjectsOfType()), and then compare the name with the name you’re looking for.

Note, this will be very slow, and I don’t advise doing it regularly.

What exactly are you trying to accomplish? As there may by a more efficient way to do what you need.

I would remove or the clone object spawned in the game

There can be no GameObjects in the scene that you didn’t create at some point. So why not keep track of this as you create them?

Well I would delete the previous stage and create a new one.The first time it works the second they are overlaid so I need by clicking a button to remove the previous gameobjects

Are they always coming in stages (ie: groups)?
If so, you could make a list of each game object in the group when it’s created, and then it’s available for you when you want to remove (them).

They came from different arrays,like Enemies ,Platforms etc but I don’t want to remove them from the list because I would a complete random game where all the pieces of the level are mixed together

Sorry, I just don’t fully understand your question/situation…

Well there is another solution.
1)I create a first panel with a button where by clicking it I delete the objects
2)Then a second panel appears and I instantiate the scene.I love unity you can find always a smart solution