About delete the object pc.Light

Hi, while I was trying to delete the light component, I can’t find the function that was used to remove the _shadowCamera.

Can you explain in a bit more detail what the problem is here? Perhaps by linking to a simple reproducible test case? It’s not really possible for somebody to solve your problem with the information you’ve provided. Thanks!

Hi,the question can be more detailed:
If I call the function Scene.destroy or Entity.destroy, can I destroy all the JavaScript Object, Light Map, Shadow Map, ForwardRender, index-buffer, vertexBuffer, RenderTarget ,etc?

When light is removed/destroyed, associated resources with it, such as shadowmaps, render targets, etc will be removed as well.
If you delete a model (destroying entity with model component), that has lightmap on it, then associated resources will be deleted accordingly as well.

Each asset has unload method as well for manually releasing associated resources.

Hello everyone,

I have attempted to free up the ShadowMaps VRAM usage by destroying the light source inside a scene, as it was outlined in Max’s answer. Sadly I had no success with it.

Here is a test-project:
https://launch.playcanvas.com/534439?debug=true

You can destroy the lightsource by pressing the middle mouse button.
When destroying the light source I can see no difference in the Shadowmap VRAM usage in the PlayCanvas debugger (open with CTRL + ALT + T).

I tried to delete the entities in the scene aswell, but this also made no difference.

What additional step do I have to take to clear up ShadowMaps usage in VRAM ?

Thank you!

Editor link:
https://playcanvas.com/editor/scene/534439

@Mr_F that will be for you :slight_smile:

That seems like a bug.