External Resource Folder -- Please Help

Hi, so I have a Resource folder within my project that i can load textures from. but id like the player to be able to load their own textures from an external resource folder (or any folder they choose)

this is my code so far:

	void OnGUI ()
	{
		
		filelocationinput = GUI.TextField (new Rect (10, 10, 128, 20), filelocationinput);
		
		
		if (GUI.Button (new Rect (10, 35, 128, 32), "Load!")) {
			LoadTexture ();
			
		}
	}
	
	void LoadTexture ()
	{
	
		Texture2D boxtexture = Resources.Load (filelocationinput) as Texture2D;
		Debug.Log ("loaded texture: " + filelocationinput);
		renderer.material.mainTexture = boxtexture;
		
	}

as you can see i have a GUI text field which i want the player to type the file location into (for example: “/Desktop/Game/GameDATA/ExtResource/texture.png”)

but of course the code i have atm only loads from the compiled resource folder. any help would be much apreciated.

You’re probably already aware, but the Resources class won’t be able to do that for you: it only really supports compiled resources that are shipped with your project.

Instead, you can use the WWW class to request a local file (ie: file:///path/to/file/my_texture.jpg), wait for the “download” to finish, then call LoadImageIntoTexture to convert that file into a texture. The function linked has a decent example.

This opens up a new can of worms, of course. How do you know which folder to search? Can the user select files in some sort of visual browser? Or will you just check their user docs folder for some specific path/name? The System.IO namespace provides Path and Directory classes that may be very helpful, there.