PrefCrypt is a very simple script for quick encryption and decryption of values while expanding on PlayerPrefs. Works the same as PlayerPrefs just with more compatibility.
Currently supported
String , String
Int , Int
Long , Long
Float , Float
Bool , Bool
Color , Color
Vector4, Vector4
Vector3 , Vector3
Vector2 , Vector2
Double , Double
Rect , Rect
DateTime , DateTime
Quaternion, Quaternion
Transform , Transform
With an expansion to what you can save, along with added Encryption, you’ll have values that your average player can’t edit so easily anymore.
With new editor
That is an example on what you would have to do on your end to save or load in your existing code.
The reason I have DateTime in a Debug is because you can’t exactly have it as an inspector variable, so I needed a way of testing it. You might also notice how GetTransform is different from the others. The reason being is because Transforms need an object to exist. So to get around this, I simply reference the object’s transform in the GetTransform function. It works the same as every other function this way.
If you were to try and use a regular PlayerPrefs to get something saved with PrefCrypt, it would return 0 or a strange negative. Same the other way around. If you saved with normal PlayerPrefs, you can’t use PrefCrypt to access it.
Update: Added in Array variables. So now it supports Encrypted PlayerPrefs of
String , String
Int , Int
Long , Long
Float , Float
Bool , Bool
Color , Color
Vector3 , Vector3
Vector2 , Vector2
Double , Double
Rect , Rect
DateTime , DateTime
Transform , Transform
With this I’ve submitted it to the asset store. It’ll be priced at $5. Because I couldn’t add any external editors or something to watch over your saved variables, I felt this was an appropriate price for the work I put in. If it’s accepted, I hope to add those kind of features in a later update to help make management of saved variables easier.
Update: It got declined, sadly. Apparently due to me referencing my youtube as my website instead of a GitHub or Linkedin. I’ll be fixing these up and resubmitting. Before I do, any features suggested for this? I’m open to anything if it adds to the features.
Update: It will now include a small Example Scene with a player script to show how it saves usual values such as Int, Extended values like color and Transform, and then arrays.
Also made a quick video to show how easy it is to use
Nice asset. But it looks like the manual is missing information about how to store & load arrays. I had to look at the screenshots to figure out that I have to add Array to it. Like PrefCrypt.SetVector3Array()
I think it could go in either, but if it needs to be in the other I don’t mind someone moving this for me lol. And thank you for the input, I’ll be sure to update the manual. Quaternions is definitely doable and will be added. I’ll have to research what a Vector 4 is but it shouldn’t be too difficult to add
BTW: Would be easier if we could copy/paste the code example from the manual. And if you would offer a download of the PDF just because it is nice to read that before buying it.
I would also show an example on the Asset Store and in the manual how the encrypted PlayerPrefs finally looks like – just because this is what it is about.
I think an option to encrypt the key too would be useful. That would make it even harder to try to cheat.
I’ll see about loading up the PDF somewhere. And well its hard to show what a playerpref looks like since it isn’t stored as a value in the project, but on the device. Its why I tried to show in the video what happens and what I code I used. If you try to use a playerpref to call a prefcrypt variable, it usually just returns 0
Ahhh, I had no idea that was a thing. I work on Windows and I have to go into regedit just to view it. I didn’t know exactly what values to show from in there so I left it be.