Pass parameters via same scene not working

I have a logic trigger

local options = {

                                effect = ‘slideLeft’,

                                time = 500,

                                params = {

                                    stageId = stageId,

                                    levelId = levelId,

                                },

                            }

                            storyboard.gotoScene(‘sceBoard’, options)

where i am currently in sceBoard.

And i realized if i come from another scene (with the same logic above), my sceBoard able to receive the passed parameters.

But it doesn’t work if i trigger it while i am in sceBoard.

Anyone facing this issue?

Thanks for helping

This is a known behavior.  I’m not sure I would classify it as a bug, since you are in that scene already, you can set local variables to have the values you want when you reload.  I also would use storyboard.reloadScene() instead of trying to goto the scene you’re currently in.

Rob didn’t want to repost himself, but here is his tutorial on scene reloading:

http://www.coronalabs.com/blog/2013/08/20/tutorial-reloading-storyboard-scenes/

I am also facing the same issue, where when re-loading a scene (using storyboard.gotoScene) with a different set of 

‘parameters options’ will NOT pass these data variables. It will just return ‘nil’ in event.params

Although setting the local variables and calling reloadScene() works, it makes things trickier…

I would prefer the gotoScene to work like it should, regardless whether it is calling the same scene name. 

You cannot go to the scene that’s currently showing.  Storyboard builds a new scene, moves it on screen and potentially gets rid of the old one (at least hides it).  You have two choices, use a cut scene (recommended) or use storyboard.reloadScene() and go through the steps necessary to make reloadScene() work.  ReloadScene doesn’t take parameters anyway because you’re already in the scene and in theory you should have access to set whatever values you need.

How i play the magic?

Instead of passing the values to same scene, those value are GLOBAL.

So everytime before reloadScene/go back same scene, i reset the GLOBAL to desire values.

if stageId and levelId are declared:

local stageId

local levelId

at the top of your scene file (not inside any function), they they will hold the same values when the scene reloads.  No need to pass the parameters.

This is a known behavior.  I’m not sure I would classify it as a bug, since you are in that scene already, you can set local variables to have the values you want when you reload.  I also would use storyboard.reloadScene() instead of trying to goto the scene you’re currently in.

Rob didn’t want to repost himself, but here is his tutorial on scene reloading:

http://www.coronalabs.com/blog/2013/08/20/tutorial-reloading-storyboard-scenes/

I am also facing the same issue, where when re-loading a scene (using storyboard.gotoScene) with a different set of 

‘parameters options’ will NOT pass these data variables. It will just return ‘nil’ in event.params

Although setting the local variables and calling reloadScene() works, it makes things trickier…

I would prefer the gotoScene to work like it should, regardless whether it is calling the same scene name. 

You cannot go to the scene that’s currently showing.  Storyboard builds a new scene, moves it on screen and potentially gets rid of the old one (at least hides it).  You have two choices, use a cut scene (recommended) or use storyboard.reloadScene() and go through the steps necessary to make reloadScene() work.  ReloadScene doesn’t take parameters anyway because you’re already in the scene and in theory you should have access to set whatever values you need.

How i play the magic?

Instead of passing the values to same scene, those value are GLOBAL.

So everytime before reloadScene/go back same scene, i reset the GLOBAL to desire values.

if stageId and levelId are declared:

local stageId

local levelId

at the top of your scene file (not inside any function), they they will hold the same values when the scene reloads.  No need to pass the parameters.