I
I
i__egor2019-02-19 06:53:50
Unity
i__egor, 2019-02-19 06:53:50

How to read/create text files while playing Unity (Android)?

Hello. I connect System.IO on the computer and write something like this:

string path = "Assets/Resources/text1.csv";
string content = new StreamReader(path).ReadToEnd();

- everything is working. I'm doing an androyd assembly - the files are not loading.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
freeExec, 2019-02-19
@i__egor

Because this file is not even on the computer after assembly, it is in the resources and it must be read accordingly through Resources.Load("text1").
https://docs.unity3d.com/Manual/class-TextAsset.html
PS. and you will have to rename it to text1.csv.txt

A
Alex Maximovich, 2019-02-19
@flexer1992

https://docs.unity3d.com/ScriptReference/Applicati...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question