Using www.Texture help?

Help!

I’m trying to figure out what the correct datapath and everything is for using www.Texture to import a .png from the local project folder, and using it as a texture. I can’t find any reference for this on the Unity website–it only states how to load things from the web. When I attempt to do this on my own, it works, but I get a data path error first. Do you know how?

My script, in case you’re interested, is this:

var filePath;

function Start()
{
	filePath = "myScreenshot.png";
	print(filePath);
}

// Take a shot immediately
function Update () 
{
    if(Input.GetKeyDown(KeyCode.P))
    {
    	turnScreenShotIntoTexture();
    }
}

function turnScreenShotIntoTexture() 
{
	yield WaitForEndOfFrame;
	Application.CaptureScreenshot("file:\\" + Application.dataPath + filePath);

    var www : WWW = new WWW (filePath);
    yield www;
    myTexture = 
    renderer.material.mainTexture = www.texture; 
}

It’s actually the other way round: Application.CaptureScreenshot can take only the filename and it will save it to the current directory, but www always needs an absolute path AND a protocol-scheme specification.

Application.CaptureScreenshot(Application.dataPath + filePath);
var www : WWW = new WWW ("file:///" + Application.dataPath + filePath);

ps. The file:/// version is usually more robust than file:// and also not it’s a slash not a backslash!