Unity GerFile doesn't work on build
After tons of debugging, I finally locate the problem.
private void FindAttributes(string type)
{
string path = "Assets/Resources/" + type + "/";
foreach (string file in Directory.GetFiles(path))
{
string folder = file.Substring(path.Length);
folder = folder.Substring(0, folder.Length - 5);
It is the Directory.GetFiles(path) that causes problem. Forgot to say my problem. My problem is, it does return the files to me in the play mode in the unity and it also works when I use the build created by "Build And Run". However, when I open the build from the folder, this doesn't work. The function breaks down in the forloop because of the Directory.GetFiles. I am not sure why, but is there a way to fix this?
Your answer
Follow this Question
Related Questions
How to duplicate a file and save it in a new folder? 0 Answers
File.Move() on Android doesn't seem to work. 0 Answers
EDITOR HOW TO GET A TEXT FILE OBJECT OR INSTANCE ID TO FOCUS THE PROJECT WINDOW ON IT 1 Answer
Taking a Screenshot and then displaying the Screenshot in game 0 Answers
Best way to browse folder? 0 Answers