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

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

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2022-01-18
  • 2021-06-09
  • 2021-10-09
  • 2021-06-18
  • 2022-02-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2022-01-10
  • 2022-12-23
  • 2021-06-16
  • 2022-01-14
  • 2021-07-05
相关资源
相似解决方案