Application.streamingAssetsPath Android平台上不能用File直接读取,必须通过WWW

Image

// Application.streamingAssetsPath 获取StreamingAssets文件夹的物理路径

IEnumerator Start()
    {
       string Url ="file://"+Application.streamingAssetsPath + "/1.jpg";
        WWW www = new WWW(Url);
        yield return www;
        if (www.error != null)
            Debug.Log(www.error.ToString()+"...ERROR");
        Texture2D t2d = www.texture;
        gameObject.renderer.material.mainTexture = t2d;
       // Debug.Log(Url);
    }

posted @ 2020-03-16 08:49  opencoder  阅读(2199)  评论(0编辑  收藏  举报