Hi @tharek.ali, I think what may be happening is that you’re deleting your camera when changing scenes but only creating it when building the scene. You’ll need to put your camera construction code within one of your scene show code sections. By putting it at the top of your code, you’re only building the camera when the scene is first loaded (say, the first time you go to it or after you explicitly remove it), but you’re trying to use it every time. After :destroy(), the camera is just an empty shell that you can nil out. Trying to use it will result in errors because it’s no longer functional.
local perspective = require("perspective") local camera function scene:show(event) if "will" == event.phase then camera = perspective.createView() end end -- Continue as normal
Hi @tharek.ali, I think what may be happening is that you’re deleting your camera when changing scenes but only creating it when building the scene. You’ll need to put your camera construction code within one of your scene show code sections. By putting it at the top of your code, you’re only building the camera when the scene is first loaded (say, the first time you go to it or after you explicitly remove it), but you’re trying to use it every time. After :destroy(), the camera is just an empty shell that you can nil out. Trying to use it will result in errors because it’s no longer functional.
local perspective = require("perspective") local camera function scene:show(event) if "will" == event.phase then camera = perspective.createView() end end -- Continue as normal