Hey guys, I’m having a problem when running my app on Android.
I am building an app that loads all files (pictures, texts and 3D objects) from one of many folders using Resources.Load and displays them on screen. This now works great in the Editor, but building an apk and installing that on an Android device gives me the Error "DirectoryNotFoundExeption: could not find a part of the path…
This comes from the first part of my code, that is supposed to list all file paths of the files in the chosen folder.
This is the part:
TargetFolder = “Assets/Resources/ARInfo/” + CurrentTargetName + “/”;
Debug.Log(“Target Folder:” + TargetFolder);
IEnumerable GetLocations = System.IO.Directory.GetFiles(TargetFolder)
.Where(file => file.ToLower().EndsWith(“.png”) || file.ToLower().EndsWith(“.txt”) || file.ToLower().EndsWith(“.fbx”));
The Target Folder is still logged correctly, but after that I get the error.
Searching for similar problems, I found some threads saying I can’t use any file paths, like the Resources folder for example, on Android, while others said I can use Resources.Load(filepath) just like in the editor.
Now I’m not sure where the problem is…I’m still new to unity.
Do I need to change my entire way of accessing these files? And if yes, how would I do that so it works on Android?
Any help would be appreciated!