Giter VIP home page Giter VIP logo

unity-player-prefs's Introduction

Introduction

Hi there fellow clanmate, welcome to this short course on Player Preferences or PlayerPrefs in Unity!

Hi!

Have you ever felt like you have played a lot and the game is still going on, so wouldn't it be great to start from a checkpoint tomorrow, saving your current progress. This is called saving and some devices or consoles also uses memory cards to store certain information, like playstations.

Intro!

In order to save the game progress, Unity provides something called “Player Preferences” or ‘PlayerPrefs’ in short. This is a class that stores Player preferences between game sessions. What this means is, say you exit from the game today and re-open it tomorrow, it should be able to save your previous session and start from where you left off and shouldn’t start from the beginning of the game itself, what we call as ‘SAVING’ in games. PlayerPrefs can store string, float and integer values into the user’s platform registry. The location of saving these values will depend on the type of platform being used as mentioned below.

Standalone Player storage location

On macOS, PlayerPrefs are stored in

~/Library/Preferences/com.ExampleCompanyName.ExampleProductName.plist

Unity uses the same .plist file for projects in the Editor and standalone Players.

On Windows, PlayerPrefs are stored in HKCU\Software\ExampleCompanyName\ExampleProductNamekey.

On Linux, PlayerPrefs are stored in ~/.config/unity3d/ExampleCompanyName/ExampleProductName

On Windows Store Apps, PlayerPrefs are stored in %userprofile%\AppData\Local\Packages[ProductPackageId]\LocalState\playerprefs.dat

.On Windows Phone 8, Unity stores PlayerPrefs data in the application's local folder. See Directory.localFolder

for more information.

On Android, PlayerPrefs are stored in /data/data/pkg-name/shared_prefs/pkg-name.v2.playerprefs.xml

. Unity stores PlayerPrefs data on the device, in SharedPreferences

. C#, JavaScript, Android Java and native code can all access the PlayerPrefs data.

On WebGL, Unity stores PlayerPrefs data using the browser's IndexedDB API. For more information, see IndexedDB

In-Editor Play mode storage location

On macOS, PlayerPrefs are stored in /Library/Preferences/[bundle identifier].plist

On Windows, PlayerPrefs are stored in HKCU\Software\Unity\UnityEditor\ExampleCompamyName\ExampleProductName key.

Windows 10 uses the application’s PlayerPrefs names. For example, Unity adds a DeckBase string and converts it into DeckBase_h3232628825. The application ignores the extension. Unity stores PlayerPrefs in a local registry, without encryption. Do not use PlayerPrefs data to store sensitive data. There are a lot of different data types that can be stored using this class, of course using Get and Set methods they can be fetched and set respectively. The various data types allowed are: Float Int String

Enroll yourself and get rewarded when you complete the course 🎁

As you learn and upskill yourself, you can earn learning points. These points can be redeemed for rewards, as well as in tournaments. Enroll yourself for the course by filling the form linked to the gif below and start earning your points

Click on the gif below and follow the instructions

Click me!

You can also click here - Click Here!

Move on to the next to get more insights on this topic.

unity-player-prefs's People

Contributors

rupamdebnath avatar manasoutscal avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.