Instantiate without creating clone

Hello, I would like create and spawn a GameObject directly from my code to the scene. I read that if I wanted to do that, I should use Instantiate(). My issue with this though is that it’s creating a clone, which I don’t need. I simply want to spawn the original GameObject into the scene.

void createFairy()
    {
        if (Input.GetKey(KeyCode.F))
        {
            GameObject objectToCreate = swap.getPlayables();
            objectToCreate = Instantiate(new GameObject("Fairy"));
            objectToCreate.tag = "Playables";
            //Instantiate(objectToCreate);
        }
    }

This is what I get when I press the F button:
77050-da975ae0cefedf8f79e6621bb95f421f.png

Thanks in advance for the help!

“new GameObject()” already instantiates the GameObject in the scene, and Instantiate makes a copy of whatever you pass to it. You have the Fairy and the clone because you’re telling Unity to create the Fairy (with new GameObject(“Fairy”):wink: and then make a copy of it (with Instantiate).

Just remove the “Instantiate”:

void createFairy()
{
    if (Input.GetKey(KeyCode.F))
    {
        GameObject fairy = new GameObject("Fairy");
        fairy.tag = "Playables";
    }
}

or change the name after it is instantiated.

				objectToCreate.name = "NewFariy_Obj" + spawned;

				spawned++;