Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Kronus.

PlayerPrefs "Extended"

Recommended Posts

Hey guys,

 

I'm making a project to waste time, and in this project I'm using ArmedPrefs(made by Erarnitox), but sometimes I just need PlayerPrefs to save things like Resolution, Quality and etc... So I wrote this script to "make it more easier".

 

What are the advantages?

 

1st - You can load things in two ways now:

 

Ex: DataManager.GetInt("MyInt")

 

Or you can define a "default value" in the final of the function, so if this key do not really exists it will return this value, create and save a new key with the name and the value you used.

 

Ex: DataManager.GetInt("MyInt", 100); // it will return 100, create and save the key if it not exist.

 

 

2nd - You can now save and load boolean variables.


Ex: DataManager.SetBool("MyBool", true);

Ex: DataManager.GetBool("MyBool");

Ex: DataManager.GetBool("MyBool", true);

 

3rd - Set functions are now saved automatically, so you do not need to use PlayerPrefs.Save(); or DataManager.Save();

 

4th - If you want to use this instead PlayerPrefs, you just have to change "PlayerPrefs" to "DataManager".

 

The miracle code :d

Please login or register to see this quote.

 

This script is very simple, but I hope it can help someone :d

 

Please login or register to see this attachment.

Edited by Kronus.
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...