How to open Android device Internal storage text file in Unity
I need to open the path "storage/emulated/0/" which is the main path of internal memory in android. I mean the default for each device. if it is possible? I mean the c # code. Because I have a txt file in the android internal memory folder. I want to open it in unity. I have tried some code but it wants work.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using System.IO;
public class script : MonoBehaviour
{
string [] nameArray;
string FilePath, fileName;
public Text showText;
void Start()
{
fileName = "user.txt";
FilePath = "/storage/emulated/0/Documents/user.txt";
ReadFromFile();
}
public void ReadFromFile()
{
nameArray = File.ReadAllLines(FilePath);
foreach(string line in nameArray){
print(line);
showText.text = line.ToString();
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Can not load the next scene 0 Answers
When I add a score, the scoreText just rapidly displays the scores added to itself 1 Answer
Android PersistentDataPath UnauthorizedAccessException 0 Answers
How to make my GameObject move on a fixed Platform 0 Answers
"Set-up Android SDK path to make Android remote work" 2019.1.1 8 Answers