read in position data from .txt

Hey guys. I’m trying to read in a massive amount of x,y,z and radius data from an external output file(s) and then move them forward in time based on their updated positions (also from output file(s)). Also, for each particle position and radius I would like to generate an in game sphere with that radius value and at the correct position. Ideally, these spheres will recreate a simulation of a star off of the smoothed particle data. I’m very inexperienced with C#, so any help would be appreciated.

Read file in C#: How to: Read text from a file | Microsoft Learn

Define your model of data, like: “x;y;z;r” per line in the file, get a line and split it with SplitString(“;”) and you will get a array string with all strings separeted by ‘;’. Then access each string by the position and create a new Vector3:

var pos = new Vector3(float.TryParse(array[0]), float.TryParse(array[1]), float.TryParse(array[2]));

Then assign it to your transform.