动态加载本地图片

public class WWWTest : MonoBehaviour
{
    RawImage oldimg ;
    public Text _text;
    // Use this for initialization
    void Start()
    {
      
        oldimg = GetComponent<RawImage>();
        string path1 = @"file:///C:\Users\37864\Desktop\TS\"+ _text.text+".jpg";
        StartCoroutine(test(path1));
    }
    public IEnumerator test(string path1)
    {
        WWW www = new WWW(path1);
        yield return www;
        oldimg.texture = www.texture;

    }

猜你喜欢

转载自blog.csdn.net/vickieyy/article/details/89601479