public class Testinput : MonoBehaviour {
GameObject go;
List<GameObject> gos = new List<GameObject>();
// Use this for initialization
void Start () {
int i = 1;
while (true)
{
go = GameObject.Find("GameObject");
if (go)
{
go.name = i.ToString();
gos.Add(go);
i++;
}
else
{
break;
}
print(i);
}
foreach (var item in gos)
{
item.name = "GameObject";
}
print(gos.Count);
}
}