I am trying to create an object( 2D Cube) and I am using a CSV file to get its x y and z coordinates I can read and log the coordinates, but they are string so I use a method to try and convert to float. But when I play the scene the objects are not created.
distance += distanceChange;
Vector3 clickPosition = new Vector3(float.Parse(data_values[0], CultureInfo.InvariantCulture.NumberFormat),
float.Parse(data_values[1], CultureInfo.InvariantCulture.NumberFormat), float.Parse(data_values[2], CultureInfo.InvariantCulture.NumberFormat));
//Vector3 clickPosition = new Vector3(Convert.ToSingle(data_values[0]),
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.position = clickPosition;
Debug.Log(data_values[0].ToString() + " " + data_values[1].ToString() + " " + data_values[2].ToString());
I am using the float.Parse(data_values[0], CultureInfo.InvariantCulture.NumberFormat code to convert to float.