Some Windows help

I did this a few months back but I can’t remember how.

I’m trying to access a local file from a windows machine

I’ve tried many variants of this “file://c:/unity/art.png”

“file://c:\unity\art.png”

Obviously not right. What’s the trick to get to the files?

Thanks

Flash

Try using triple slashes

file:///C:/Stuff/MoreStuff/thing.png

-Jeremy

The first thing after the two slashes in an URL should be the host name, so on a local machine this should either be “localhost” or blank. Usually, the colon after the drive name is replaced with a vertical bar, so the correctly escaped URL is

file://localhost/C|/Stuff/MoreStuff/thing.png

or (with an empty host name)

file:///C|/Stuff/MoreStuff/thing.png

Another option is to leave out the host part altogether. (note there’s only a single slash after file:)

file:/C|/Stuff/MoreStuff/thing.png

these are absolute paths.
are relative paths possible?
(relative to the runtime distributable)

To hai_ok,

I’m setting up a script for switching out textures at runtime right now. I placed the textures that are being accessed in the folder with the *.app or *.exe file and use the following code. Seems to work fine on a relative level.

var url = "file://load_texture_diff.png";

function Update () {
   
   if (Input.GetButton ("Fire2")){
   
   
   renderer.material.mainTexture = new Texture2D(1024, 1024);


   new WWW(url).LoadImageIntoTexture(renderer.material.mainTexture);

   }


}

man thats awesome, thanks!