Finding the index of a gameobject by name

Hi, Excuse my foolishness. I’m trying to make it so that the player enters a string and if a gameobject by that name exists, we’ll instantiate it. I did the following but of course it doesn’t work. I wasn’t able to find anything related to this (could be my fault) and I’d like to ask you guys for help.

    public string name;
    public GameObject inputField;
    public List<GameObject> objects;

    int object_index;

    public Transform player;

    public void Creator_Input()
    {
        name = inputField.GetComponent<Text>().text;
        Debug.Log(name);
        int indexofcreation = objects.IndexOf(name); 
        Instantiate(objects[0], new Vector3(player.position.x, player.position.y, player.position.z - 2), Quaternion.identity);

    }

public Text inputField; // Drag & drop the gameObject with the Text component in the inspector
public List objects;

 public Transform player;

 public void Creator_Input()
 {
     int objectIndex = objects.FindIndex(gameObject => string.Equals(inputField.text, gameObject.name));
     if(objectIndex >= 0)
         Instantiate(objects[objectIndex], new Vector3(player.position.x, player.position.y, player.position.z - 2), Quaternion.identity);
  }