When I use envAtlas to set the environment and use the webview in ios to open it, it will occasionally turn black

The use of envAtlas is to solve the following problem

There is an issue with HDR disappearing when embedding PlayCanvas through a webview on iOS

On the ios device, there is a problem with the envAtlas set when using webview to access, the car has no ambient light, and the default skyBox does not appear. Most of the time there is no problem, the probability of it happening is very low, but it happened. And there is no error.

Below is my code, which works fine


var LoadEnvAtlas = pc.createScript('loadEnvAtlas');
LoadEnvAtlas.attributes.add('envAsset',{type:"asset",assetType:"texture"});

LoadEnvAtlas.prototype.initialize = function() {

    let url = this.envAsset.getFileUrl();
    try{
        url = url.replace(ASSET_PREFIX, "")
    } catch{
        url = url .substr(5);
    }

    const asset = new pc.Asset(
        "helipad-env-atlas",
        "texture",
        { url:  url},
        { type: pc.TEXTURETYPE_RGBP }
    );

    asset.ready(()=>{
        const res = asset.resource;

        this.app.scene.envAtlas = res;
    })
    this.app.assets.add(asset);
    this.app.assets.load(asset);
};

Hi @angus_young ,

Is there a way we can repro this ourselves?

Thanks

@slimbuck Thank you for your reply.

We are very sorry, we tried to make a demo, but we could not reproduce this problem. After that, I also tested various situations on the PC, and still did not encounter this problem.

It seems that he is hiding very deep.