-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I encountered this issue when using a WebComponent that embeds a PlayCanvas application inside a Vue project.
The component instance is accessed through a Vue $ref, which is actually a Proxy object.
When I call a method that alter the rendering process on the component from outside (for example to add a gizmo), the application fails to retrieve the GraphicsDevice from the internal cache.
This happens because the Proxy changes the memory reference of the application object and all of its childrens, therefore the device lookup no longer matches the original cached reference.
engine/src/platform/graphics/device-cache.js
Lines 26 to 27 in 4257ba5
| if (!this._cache.has(device)) { | |
| this._cache.set(device, onCreate()); |
It then try to call the
onCreate argument, which is often undefined ex : | const library = programLibraryDeviceCache.get(device); |
Possible fix : I think changing the DeviceCache map from Map<GraphicsDevice, any> to Map<string, any> using the device.canvas.id as key could solve this issue. Maybe it has side effect on AR/VR devices?