repalce parts of textfile
dear all.
i have a textfile which is built like this:
Quelle 120 20 *MF.Quelle
Senke 160 40 *MF.Senke
...
Now i want to move the created objects in unity (information comes from textfile) and rewrite the textfile so it looks like this
Quelle 160 40 *MF.Quelle
Senke 260 60 *MF.Senke
...
so i just need to replace parts of my textfile while the rest keeps equal.
i managed to write a textfile with following code but that is just for writing a new textfile and not rewriting the old one. i am only able to find a way to delet specific lines and write specific lines but not just parts of a line.
public void Button_export()
{
writer = new StreamWriter(path, false);
A = GameObject.Find("Quelle");
pos = A.transform.position;
var ANAME = A.name;
var AX = pos[0];
var AZ = pos[2];
writer.WriteLine(ANAME + ' ' + AX + ' ' + AZ);
B = GameObject.Find("Senke");
pos = B.transform.position;
var BNAME = B.name;
var BX = pos[0];
var BZ = pos[2];
writer.WriteLine( BNAME + ' ' + BX + ' ' + BZ);
writer.Close();
some one knows an answer? thanks in advance
Your answer
![](https://koobas.hobune.stream/wayback/20220612133934im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Upload text file to remote server from unity html hosted on same server 0 Answers
How to read specific line with Streamreader in c#? 1 Answer
Reading in from a text file (.txt) when deploying to Android devices. 0 Answers
Text file controlling movement 0 Answers
Resources.Load() doesn't work unless load path is hard coded. 1 Answer