I am creating a instantiating a Prefab when clicking on screen and saving position and name in a text file like so:
(0.9,3.7,0.0) nameA
(2.1,3.2,0.1) nameB, etc.
On load I am looping through the TextAsset and grabbing the position and string to populate my PREFAB
TextAsset textFile;
string text;
string[] lines;
textFile = Resources.Load("test") as TextAsset; // Loads file
text = textFile.ToString();
lines = text.Split('
');
for (int i = 0; i < lines.Length; i++)
{
GameObject go2 = Instantiate(prefab_, new Vector3(-0.3f, 0.2f, 1.7f) // **HARDCODED for test**, Quaternion.identity);_
}
I am ultimately trying to instantiate my PREFAB where
Vector3 will be (0.9,3.7,0.0) and Text.text component will be nameA
When I test the above, it is only instantiating the first prefab when I expect items.length as I am looping through the lines and trying to instantiate based on the count.
What is best way to achieve this?
Thank you