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