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);
    }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM