get gameobject by string

This works

var sword : GameObject;
character.GetComponent(equipment).Attach(equipmentList.sword);

This is what I want to do

var sword : GameObject;
var item : String = "sword";
character.GetComponent(equipment).Attach(equipmentList.item);

How can I pass a variable for the name of the item? Attach() expects a GameObject but I need item to be a string.

hello :slight_smile:
try this:

character.GetComponent(equipment).Attach(GameObject.Find(equipmentList.item));

watch out, because if GameObject.Find doesnt find a gameObject, it will return null.