I am using Unity 5.3.1, VS 2015 on a Windows 10 machine. When I am trying to read the contents of a directory I use the following code: Code (CSharp): public IEnumerator LoadImages(string Album) { WWW w; Texture2D t2D; //WORKING //string fn = @"D:\Daten\Benutzerprofile\Christian\Pictures\DSC00044.JPG"; //NOT WORKING, BECAUSE Environment... not available foreach (string fn in Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + "\\" + Album, "*.jpg")) { w = new WWW("file://" + fn.Replace("\\", "/")); yield return w; if (w.error != null) { Debug.Log("Error: " + w.error); yield break; } else { t2D = new Texture2D(256, 256, TextureFormat.DXT1, true); w.LoadImageIntoTexture(t2D); Images.Add(t2D); } } } The code works fine within the editor (on my windows 10 machine!), but when I build the game I end up with an compile error "Environment contains no definition for GetFolderPath" (same with SpecialFolder) in the built uwp solution. If I only access ONE file (see code above //string fn = "D:\Daten\Benutzerprofile\Christian\Pictures\DSC00044.JPG" it works in the built uwp version too, so the only problem is to get all files of a (well known) directory ... What is the recommend way for accessing local files (when building a cross platform game with unity)?
Use #if and on UWP use this class: https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.knownfolders.aspx