Jump to content

Why does this.load.path not get reset when starting a new state?


Hyakugei
 Share

Recommended Posts

Hello!

 

I found a strange (to me) behaviour. The 'this.load.path' value is not reset to null or an empty string at the end/start of a new state. I guess i see why you might want to set it once, if you have 1 place that you store all your content, but this behaviour caught me out. 

 

Is there a reason why it is not cleared automatically? I'd just like to know why the decision was made to have it that way. I guess i have been setting it in each State so this hasn't bit me before! 

 

Thanks!

 

 

Link to comment
Share on other sites

  • 3 weeks later...

I'm not the OP, but I found this as well.

this.game.state.start('Preloader', true, false);

The way I move between states is given above (for example, the above is in my Boot state).

 

I got hung up briefly the first time I ran into this, but then I figured the load manager was probably for the entirety of the game, so it makes sense it would persist between state changes.

Link to comment
Share on other sites

Sorry, lost the thread on this one. I also came to the same conclusion that Strivinglife came to, and simply ensure that the first thing in any preload section is setting/resetting the load.path value to something specific for that state. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...