Load new scene and return to the old one

Load new scene and return to the old one
0

There is a problem when i switch to new scene and return to the old scene some vars and reference keep their data and that cause a problem is there is any way to clear the vars when switch scene !

also am getting this error when i switch between scenes too fast :

Uncaught TypeError: Cannot read property '_renderFlag' of null

Show how you are transitioning between scenes please. What Creator version?

The last version 2.1.3
Both are scenes preloaded in loading screen

cc.director.loadScene("menu",function(err, data){
             cc.audioEngine.uncacheAll();
          //   cc.sys.garbageCollect();
    });

  cc.director.loadScene("BOARD",function(err, data){
        cc.audioEngine.uncacheAll();
       // cc.sys.garbageCollect();
});

it seem some scripts didn’t destroyed at switching the scene and the engine try to render them is there any way to prevent that from happening like destroy everything before switching
i tried
cc.sys.garbageCollect();
destroy()
and many other function no chance !

@slackmoehrle

We can ask @jare to help with this.

what i noticed the problem of '_renderFlag' of null happen only if i switch scenes too fast

To anyone face the same problem ( '_renderFlag' of null)
to reduce that:
After preloading the scene do not load it immediately use scheduleOnce 3s to load the scene after a while that solve my problem.