I just have a quick question regarding the camera:destroy() function when using it in a scene overlay, while using the camera perspective in the base scene. I’m currently having a memory leak due to not being able to remove the perspective while using it in a scene overlay. When I call the destroy function anywhere in the overlay, it returns a syntax error saying that the destroy function is a nil value. It only happens when I display an overlay over a class that already has the perspective called. So for example, if I use the perspective in a class that does not have an overlay, it works perfect. Or, if I call an overlay but I don’t remove the perspective, the function will still work in the base scene when I change scenes.
The error only occurs when I try to remove the perspective from the overlay, while still displaying the base scene. An example of this would be if you used the perspective for level 1, as well as inside the scene overlay to call your game over menu. Using perspective, all image objects that are not using it appear behind anything that is. So in this instance, you’d have to use perspective in the game over menu as well. That is where my problem lies. So should I avoid using perspective in overlays if I am already using the perspective in the base scene, or is there a way around the error?
If anyone wants me to post code or the error being returned to the console, let me know.