As mentioned above, I have a project that uses multiple apps. It is developed with engine and will eventually be embedded in the vue project. I called the pc.Application.destroy()
method in the beforeDestroy()
method of vue, and then set the created app instance to null, like the following:
export default {
name: "myVueContext",
displayName: "MyVueContext",
extends: common,
data(){
return{
layerName: "My Vue Context",
type: "webgl",
}
},
// Some Vue code here.
......
beforeDestroy() {
this.app.beforeDestroy();
this.app = null;
},
// Some Vue code here.
......
}
When I start the program, I call the Vue method to create multiple playcanvas apps, everything is normal, but when I delete one of the apps, other apps cannot perform mouse and keyboard input and other operations (but the console will not output any errors Information); When I also deleted the last app, the following error popped up:
I am not sure what caused the problem, but I suspect that destroy did not completely destroy the control, it was only caused by the removal of the visibility of the control, because when I clicked on the error message to view the source code, I saw an error related The code is related to continuing to render the next frame of the playcanvas app:
When I tried to continue to print the application, I found that it could still be printed, so I wonder if it is necessary to add any code besides destroy to completely destroy the playcanvas app instance.
Seek help and advice here.