assign different values to prefabs on instantiation

i have a list of strings and a number ‘j’ how many strings there are.

the instantiation of my prefabs uses

for(i=0;i<j;i++; {instantiate(prefab);}

to create exactly as many prefabs as there are strings; that part is already working.

now what i need to do is give the prefabs a value to distinguish them - preferably a string or a int (i), but i’m stuck at the part where to put it.

i added a script to the instantiation with a static variable, but of course it gets overwritten with the other instantiations so that every prefab has the same value in the end.

i also tried to just name the prefab like the string with

myPrefab.name = "String", but for some reason Unity still puts a (clone) behind it, which renders the string useless (unless i find a method to cut the (clone) from the string afterwards, but that seems to be a bit long-winded).

would be very grateful for a hint to the right direction because i’m running out of ideas right now.

Instantiate the prefab clone, then rename it:

  var newObj: GameObject;

  for (i=0;..;..){
    newObj = Instantiate(thePrefab...);
    newObj.name = "prefab#"+i;
  }

Put a script on the prefab, with a variable you set:

myPrefab.GetComponent.<MyScript>().myVariable = "String";