更改VR(UNITY)纹理时,Android应用程序关闭

我正在下载几张图片,以更改Android的360张照片(每张5760 x 2880 px)。当我更改第20张图像时,应用程序意外关闭。有人可以帮助我,我使用以下代码。

我需要将照片放在Application.persistentDataPath中。

第一个代码

UnityWebRequest wr = new UnityWebRequest("file://" + Application.persistentDataPath + "/" + point.gameObject.name + ".jpg");
    DownloadHandlerTexture texDl = new DownloadHandlerTexture(true);
    wr.downloadHandler = texDl;
    yield return wr.SendWebRequest();
    if (!(wr.isnetworkError || wr.isHttpError))
    {
        Texture2D t = texDl.texture;
        mainApp.mainView.photoApartment.getcomponent<Renderer>().material.mainTexture = t;
    }

我也使用这个。

var fileName = Application.persistentDataPath + "/" + point.gameObject.name + ".jpg";
    var bytes = File.ReadAllBytes(fileName);
    var texture = new Texture2D(6080,3040,TextureFormat.RGBA32,false);
    texture.LoadImage(bytes);

    mainApp.mainView.photoApartment.getcomponent<Renderer>().material.mainTexture = texture;
    mainApp.mainView.photoApartment.getcomponent<Renderer>().material.mainTexture = Resources.Load<Texture2D>("Textures/" + point.gameObject.name); ;
liukai1224 回答:更改VR(UNITY)纹理时,Android应用程序关闭

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2976276.html

大家都在问