做截屏功能的时候,按照例子写了一个demo,在ios上会闪退
我的手机是ios14.8
报错如下
例子代码如下
onButton_Capture() {
const renderTex = this._renderTex = new RenderTexture();
const size = view.getVisibleSize();
renderTex.reset({
width: size.width,
height: size.height,
});
let nodeCamera = this.node.getChildByName('Camera')
let camera = nodeCamera.getComponent(Camera);
camera.targetTexture = renderTex;
let width = renderTex.width;
let height = renderTex.height;
const gfxTexture = renderTex.getGFXTexture();
if (!gfxTexture) {
return null;
}
const gfxDevice = director.root.device;
const bufferViews: ArrayBufferView[] = [];
const regions: gfx.BufferTextureCopy[] = [];
const region0 = new gfx.BufferTextureCopy();
region0.texOffset.x = 0;
region0.texOffset.y = 0;
region0.texExtent.width = width;
region0.texExtent.height = height;
regions.push(region0);
const buffer = new Uint8Array(width * height * 4);
bufferViews.push(buffer);
gfxDevice?.copyTextureToBuffers(gfxTexture, bufferViews, regions);
}
我看到一个类似的情况,但是官方没有回复,麻烦官方人员看看是什么情况
Creator 3.3.1 在 iOS 端重复进入游戏,出现异常闪退