반응형
※ 과거 게시물은 현재의 모든 적용사항과 환경이 다를 수 있으며 단순한 기록으로 남깁니다.
Unity3D file write and read,,, 파일 읽고 쓰기(stream이용)
내 입맛에 바꿨는데... 예전에 했던거 보다 잘되네..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
private string filepath = "c:\\data.txt";
void Start ()
{
StartCoroutine(sendstring());
}
IEnumerator reset()
{
yield return new WaitForSeconds(3);
txtInput.text = "";
}
IEnumerator sendstring()
{
yield return new WaitForSeconds(3);
writeFile(filepath);
yield return new WaitForSeconds(2);
readFile(filepath);
}
void writeFile(string writeData)
{
StreamWriter wr = new StreamWriter(writeData);
wr.WriteLine("tipon, 000000000");
wr.WriteLine("ponpon, 3333333");
wr.WriteLine("ponpon, 3333333");
wr.Flush();
wr.Close();
}
void readFile(string readData)
{
StreamReader rd = new StreamReader(readData);
string line="";
while(true)
{
line = rd.ReadLine();
if(line == null) break;
print("sting : "+line);
}
rd.Close();
}
|
cs |
반응형
'개발 관련 > SW, App 관련' 카테고리의 다른 글
(과거게시물) Unity3D에서 자릿수 쉼표찍기 (0) | 2023.03.28 |
---|---|
(과거게시물) Unity3D 외부 이미지(jpg) 파일 배경으로 깔기 (0) | 2023.03.28 |
(과거게시물) 유니티에서 Sort 이용하기 (0) | 2023.03.27 |
(과거게시물) 안드로이드 호환기기 목록 (0) | 2023.03.27 |
(과거게시물) Unity3D에서 max key animation 적용하기 (0) | 2023.03.27 |
댓글