read text file parse problem

Hi everyone,

I’m asking because after several day of research I m still blocked.

I have a text file with this format:

 C     -0.662479     3.460245     1.908363
 C     0.419934     3.067604     1.127385
 C     0.374974     1.869134     0.409111
 C    -0.769773     1.068668     0.479418

And I want to instantiate a Gameobject with those coordinates,
for this I use this code:

public GameObject atomes;
    public class Atome : MonoBehaviour
    {

        public string atome_symbol;
        public string atome_x;
        public string atome_y;
        public string atome_z;
    }

    public void Read()
    {
        int i = 1;
        string atome_symbole = "";
        float atome_x = 0.0f;
        float atome_y = 0.0f;
        float atome_z = 0.0f;

        string[] separatingChars = { " " };

        string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Pauze\Desktop\geometry.txt");

        foreach (string linea in lines)
        {
            string line= linea.Trim();
            line = line.Replace("      ", " ");
            line = line.Replace("     ", " ");
            line = line.Replace("    ", " ");
            line = line.Replace("   ", " ");
            line = line.Replace("     ", " ");
            string[] entries = line.Split(separatingChars, System.StringSplitOptions.None);
            
            atome_symbole = entries[0];
            atome_x = float.Parse(entries[1]);
            atome_y = float.Parse(entries[2],System.Globalization.NumberStyles.AllowDecimalPoint);
            atome_z = float.Parse(entries[3]);



            GameObject newatome =  Instantiate(atomes,new Vector3(atome_x,atome_y,atome_z), Quaternion.identity );
            newatome.transform.name = $"{atome_symbole}_{i}";
            GameObject.Find($"{atome_symbole}_{i}").GetComponent<atome>().atome_sym = atome_symbole;

            Debug.Log($"{line} + {atome_x} + {atome_y} + {atome_z}");
            i++;

                   }
    }
    }

My problem is the split is not working properly. In the consol I have this:

C 0.419934 3.067604 1.127385 + 0.419934 + 0 + 0
UnityEngine.Debug:Log(Object)
dreader:Read() (at Assets/scripts/dreader.cs:61)
UnityEngine.EventSystems.EventSystem:Update()

I try tu use the Try.parse also, didn’t work.

does anyone have an idea?
I was thinking about changing the format of the file with code before to read it, but if what I’m doing here is not working, I don’t think it will work if I try to do it before.

Thanks a lot for any suggest!

for( int lineIndex = 0 ; lineIndex < lines.Length ; ++lineIndex )
{
string entries = lines[lineIndex].Split(separatingChars, System.StringSplitOptions.RemoveEmptyEntries);

		string atome_symbole = entries[0];
		float atome_x = float.Parse(entries[1]);
		float atome_y = float.Parse(entries[2]);
		float atome_z = float.Parse(entries[3]);

		GameObject newatome =  Instantiate(atomes,new Vector3(atome_x,atome_y,atome_z), Quaternion.identity );
		newatome.transform.name = $"{atome_symbole}_{i}";
		GameObject.Find($"{atome_symbole}_{lineIndex}").GetComponent<atome>().atome_sym = atome_symbole;

		Debug.Log($"{lines[lineIndex]} + {atome_x} + {atome_y} + {atome_z}");

	}