Storyboard Problem (Purge / remove Scene) -- File: bad argument #-2 to 'insert' (Proxy expected, got nil) Bad argument #-2 to 'insert' (Proxy expecte

File: bad argument #-2 to ‘insert’ (Proxy expected, got nil)

Bad argument #-2 to ‘insert’ (Proxy expected, got nil)

i get this error if i try to purge / remove the Scene at the Exit Scene function, any solution?

I have tried to remove the purge scene sentences and it works.

But i really have to purge the scene lol any clues?

thanks guys

You aren’t supposed to remove/purge the current scene while it is still active.  Place the removeScene/purgeScene code in the next scene’s enterScene function instead.

Thanks for your reply~

but I can do that in some other project lol don’t know why this one can’t.

And, it shows the same error even if I put the purge in the next scene :frowning:

I use purgeAll() to solve the problem, but that’s not the best choice i think.

It is better to check if scene is available and not already destroyed:

if storyboard.getScene(“myScene”) then

        storyboard.purgeScene(“myScene”)

        storyboard.removeScene(“myScene”)

end

Still you should not be doing this at exitScene, or at least I have heard that multiple times.

You aren’t supposed to remove/purge the current scene while it is still active.  Place the removeScene/purgeScene code in the next scene’s enterScene function instead.

Thanks for your reply~

but I can do that in some other project lol don’t know why this one can’t.

And, it shows the same error even if I put the purge in the next scene :frowning:

I use purgeAll() to solve the problem, but that’s not the best choice i think.

It is better to check if scene is available and not already destroyed:

if storyboard.getScene(“myScene”) then

        storyboard.purgeScene(“myScene”)

        storyboard.removeScene(“myScene”)

end

Still you should not be doing this at exitScene, or at least I have heard that multiple times.