Local Storage Dictionary vs Variable?

0 favourites
  • 3 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • Greetings,

    I am a little bit confused about this, there is any advantage to use local storage/dictionary instead a global variable to store a value like a score?

  • All those are different tools.

    They are all global to your project, but the main difference is the usage of Local Storage.

    This is there to "save" data in your browser (hard drive) even when you are not executing the game.

    Both the dictionary and global variables are holding values during execution only.

    The global variables are part of the system, so you can create and use them without adding an object to your project.

    Both the Dictionary and Local Storage allow you to assign a value to a "key" (string). You can do some string manipulation if required when you are mentioning the key you are trying to get.

    The global variable's name is fixed and you cannot make use of string manipulation to access it.

    Another difference is the fact using the Local Storage is asynchronous. You use the action to set value in a key and the plugin will trigger an event "on key set" to let you know the value has been "put in place".

    Global variables and dictionaries are instantaneous on this aspect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the answer

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