storyboard gotoScene drops options passed to if you are going to the same scene?

When I issue a “storyboard.gotoScene( “scene1”, options )” from already within the same scene, the options I pass as the 2nd parameter are not becoming available at all within didEnterScene?

This would appear to be a bug correct?  

Background:  So example would be using want to jump from one game level to another game level directly.  So don’t want to have to go back to the level selection screen, but merely go straight back into the same game scene, passing the level number as a parameter within the options.  

So for example if issuing from within the scene:

        local options = { params = {data = "Test 123"} }         storyboard.gotoScene( "scene1", options ) 

Then within enterScene I have:

function scene:enterScene( event )     -- MODIFIED TO SHOW ISSUE     print("enterScene - event.params", event.params)

The output is:

enterScene - event.params    nil

As an example I modified the main.lua and scene1.lua files from the Corona SampleCode/Interface/Storyboard app.   Files attached.

QUESTIONS:

a) Is this a bug?

b) If yes, is there an indication when it will be fixed?

c) If yes, what would be the best work around in the meantime?

d) If no, why not, for my understanding?  How then would one typically restart the same level with some different input then?   

Thanks

a) it might be a bug, but we offer a storyboard.reloadScene() to restarting a scene.  I don’t think storyboard is designed to gotoScene(currentScene) like you are trying to use it.  So I think I would describe this as “undefined behavior”.  Have you tried reloadScene()

b ) Well, if it’s a defined behavior you may very well be the first person to come over this.  If the bug hasn’t been reported, we can’t fix it.  Try to reduce this down to a small, reproducable sample and use the “Report a Bug” feature at the top of the page.  If it’s a bug, this will get it into the repair queue and we will have to see where it fits in.

c) Try storyboard.reloadScene() instead

d)  If you know you need to restart the scene, just set your variables.  Maybe just before you call reloadScene() set a flag

reloadingScene = true

someVaraibleThatNeedsSet = someValue

storyboard.reloadScene()

then in your willEnterScene() or enterScene() do somehting like:

if not reloadingScene then

      – load the params

end

– else your variables will already be set.

a) it might be a bug, but we offer a storyboard.reloadScene() to restarting a scene.  I don’t think storyboard is designed to gotoScene(currentScene) like you are trying to use it.  So I think I would describe this as “undefined behavior”.  Have you tried reloadScene()

b ) Well, if it’s a defined behavior you may very well be the first person to come over this.  If the bug hasn’t been reported, we can’t fix it.  Try to reduce this down to a small, reproducable sample and use the “Report a Bug” feature at the top of the page.  If it’s a bug, this will get it into the repair queue and we will have to see where it fits in.

c) Try storyboard.reloadScene() instead

d)  If you know you need to restart the scene, just set your variables.  Maybe just before you call reloadScene() set a flag

reloadingScene = true

someVaraibleThatNeedsSet = someValue

storyboard.reloadScene()

then in your willEnterScene() or enterScene() do somehting like:

if not reloadingScene then

      – load the params

end

– else your variables will already be set.

Rob,

Why is reloadScene not supporting the options params? It makes so much sense to update params and call reloadScene to change something in the scene. This leads to better code structure as my enterScene does not need to know and track how the scene was ‘entered’… Is it at all possible to have reloadScene support the options / params as does gotoScene?

Thanks,

Kerem

You know Kerem, I don’t have the answer for that.  I’m pretty sure that was done before I came on board, so I don’t have a back history on that call.  It could be an oversight, it could be we didn’t think it was needed.  Since the scene isn’t re-required, you could save the params in a local variable in the scene’s main chunk and you would still have them.  Or people could store them in the storyboard object which is how params were passed before we started supporting them as a table passed in.

Of course, I can see the point of where params are read in enterScene() and since enterScene() is called as part of the reload process, one would expect them to still be there.  Since I don’t use reloadSceen, are the params nil or are they the original params when the scene was first called?

I did not see any filed bugs about this.  Can you build a small test case that demonstrates the problem and report the bug using the “Report a bug” at the top of the page?

I know folks don’t like this process, but if we have a test case, then it speeds up our time to diagnose the problem.  If the engineers have to try and write the code, they may not reproduce your problem exactly.   The forums are a great place to discuss problems and determine if its local to the developer or something the engineers need to look at, but the engineer’s work is scheduled out of things in the bug tracker.

Thanks

Rob

Hi Rob,

Thanks much for your thoughtful response. To your question, the params are nil after a reloadScene() is called. I am implementing a workaround along the lines you mention but it would be neat if in future we can get reloadScene() to support params.

Regarding filing bug reports… I don’t have a problem doing that actually. The philosophical question is whether this is a bug or a feature… If you think we can safely treat this as a bug I will go ahead and create the test case and file a bug. I am finding that the WidgetDemo is a gem when it comes to quickly making test cases. 

Best regards,

Kerem

New feature requests need to go through the feedback system, but this case, it’s either a bug or it’s not clearly documented, in Corona Labs case, that needs to be reported so a bug report is justified.  The engineers may come back and say it’s working as designed, but if they do, we need to update the docs to be clear about it.

Ok. Understood. Will file a bug as soon as I can get to it then. Thanks

Rob,

Why is reloadScene not supporting the options params? It makes so much sense to update params and call reloadScene to change something in the scene. This leads to better code structure as my enterScene does not need to know and track how the scene was ‘entered’… Is it at all possible to have reloadScene support the options / params as does gotoScene?

Thanks,

Kerem

You know Kerem, I don’t have the answer for that.  I’m pretty sure that was done before I came on board, so I don’t have a back history on that call.  It could be an oversight, it could be we didn’t think it was needed.  Since the scene isn’t re-required, you could save the params in a local variable in the scene’s main chunk and you would still have them.  Or people could store them in the storyboard object which is how params were passed before we started supporting them as a table passed in.

Of course, I can see the point of where params are read in enterScene() and since enterScene() is called as part of the reload process, one would expect them to still be there.  Since I don’t use reloadSceen, are the params nil or are they the original params when the scene was first called?

I did not see any filed bugs about this.  Can you build a small test case that demonstrates the problem and report the bug using the “Report a bug” at the top of the page?

I know folks don’t like this process, but if we have a test case, then it speeds up our time to diagnose the problem.  If the engineers have to try and write the code, they may not reproduce your problem exactly.   The forums are a great place to discuss problems and determine if its local to the developer or something the engineers need to look at, but the engineer’s work is scheduled out of things in the bug tracker.

Thanks

Rob

Hi Rob,

Thanks much for your thoughtful response. To your question, the params are nil after a reloadScene() is called. I am implementing a workaround along the lines you mention but it would be neat if in future we can get reloadScene() to support params.

Regarding filing bug reports… I don’t have a problem doing that actually. The philosophical question is whether this is a bug or a feature… If you think we can safely treat this as a bug I will go ahead and create the test case and file a bug. I am finding that the WidgetDemo is a gem when it comes to quickly making test cases. 

Best regards,

Kerem

New feature requests need to go through the feedback system, but this case, it’s either a bug or it’s not clearly documented, in Corona Labs case, that needs to be reported so a bug report is justified.  The engineers may come back and say it’s working as designed, but if they do, we need to update the docs to be clear about it.

Ok. Understood. Will file a bug as soon as I can get to it then. Thanks

Any status on this?  Params are nil after I call “reloadScene”.  Ksan - what was your work around?  Thanks

Been a while so I can’t recall off the top of my head. I think I used the local variable method Rob suggested in a few posts up.

Any status on this?  Params are nil after I call “reloadScene”.  Ksan - what was your work around?  Thanks

Been a while so I can’t recall off the top of my head. I think I used the local variable method Rob suggested in a few posts up.