using new localstorage plugin

0 favourites
  • 5 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • in my previous projects i used webstorage plugin and it worked great.

    but now in version r206 its been depracated

    and i cant even get localstorage to work,when i debug, i see it working correctly but it never writes to the browser,when i monitor in developer mode in chrome i cant find the key i set in localstorage,

    when i load an old .capx file that used webstorage the plugin is still there and working, but not in my new projects.

    whats the trick to get it working?

  • You are probably mixing the order up. The difference between webstorage and localstorage is you have to wait for responses using events. It can't be thought of like you do an Array etc., it's asynchronous. It's a bit like talking to someone over a very bad phone line.

    If you look here http://myconstruct2dev.blogspot.co.uk/2 ... roids.html and the github link on the page there is a game where it definitely does work <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";-)" title="Wink"> and it's a very simple implementation

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • i have a project created with older version of c2 that used webstorage, this works with latest release if i leave code untouched but if i try to copy code to new project it wont work, so it seems i have to ditch that code for localstorage plugin,kinda sucks webstorage was easy to use, required less code and more apropriate since i only want to store session parameters.

    how do you store session parameters with localstorage?

    keep deleting them on every launch?

  • If you copy code of the webstorage directly over to another project, it won't work indeed because you are missing the webstorage plugin itself in the project.

    You could add it by right-clicking the "Add plugin" dialog and selecting "Show deprecated plugins".

    WARNING: Someday webstorage support will surely disappear from browsers themselves, and that day, your project/game simply won't work anymore.

    The local storage don't have session storing, but at the same time, session storing can be achieved simply by using global variables.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)