loading texture from folder dynamically?

silly question i think…

if i place a texture in the same folder as the .exe, is it possible to dynamically load that texture to a 3d object?

Try This

So i figgured it out! its taken me all day but with the help of AR_Rizvi its all working!!!

the problem… you cant use a friggin PSD file like you can if you were to just drag and drop it onto the object!!! so annoying!!!

// Add this script to a GameObject. The Start() function fetches an
// image from the documentation site.  It is then applied as the
// texture on the GameObject.

using UnityEngine;
using System.Collections;

public class tex : MonoBehaviour {

    private string url = "file:///Users/theuser/Desktop/map.png";
    
    IEnumerator Start() {
    
        Texture2D tex;
        tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
        WWW www = new WWW(url);
        yield return www;
        www.LoadImageIntoTexture(tex);
        GetComponent<Renderer>().material.mainTexture = tex;
    }
}

Hope this helps someone else out cos ive been beating my head over it all day!!