Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[DEPRECATED] CloudPrefs - Bring PlayerPrefs to the Cloud!

Discussion in 'Assets and Asset Store' started by Novack, Apr 14, 2016.

  1. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841

    CloudPrefs offers a simple and effective way to persist the Unity PlayerPrefs on the cloud.

    Using the Google Sheets for Unity technology principle, which frees Unity developers & projects from third party dependencies and credential requirements, allowing your games to have a simple yet powerful backend to store player preferences online, without end user logins or auth processes involved.

    Using private Google Spreadsheets as persistence layer, results very flexible and convenient for developers and administrators, allowing to take advantage from the power for easy visualization, editing, sharing, and handling of data of the Google Drive environment.

    Summary:

    • Persist Unity PlayerPrefs to the Cloud.
    • Fast local buffer.
    • Unobtrusive: trivial changes required, just two script files.
    • No credentials required Unity side.
    • Source code included.
    • No dependencies, plain Unity API calls.
    • Use private Google spreadsheets.
    • Easy deployment.
    • Detailed Developer Guide.
    • Simple example included.





    Important: As per Unity default security measures, this will not work on WebPlayer. WebGL builds will be supported on future versions.
     
    Last edited: May 4, 2016
  2. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    After a few days of soft launch, CloudPrefs is officially released!
     
    Last edited: May 4, 2016
  3. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    303
    Does this uses the User Google Sheets or the Developer Google Sheets?

    Can this be used to make a High Score System online? and all the players add data to the same Sheet?
     
  4. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @daville,

    Not sure what you call User or Developer Google Sheets, could you elaborate?

    This asset is an enhancement of the Unity native PlayerPrefs API with cloud persistence. If you need a more general approach into dealing with Google Spreadsheets from within Unity, have a look at Google Sheets For Unity.
     
  5. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    303
    I think your other plug in is perhaps what I need.

    But what I meant with user and developer sheets is... similar to "google play services".

    By User Sheets:
    As I understand Google Play Services uses the final user own Google account and own spreadsheet to store stuff online, So the user consumes their own Google Drive Space to store their own data, but that Data cannot be compared to other users data.

    By Developer Sheets:
    Similar to the other one, but I was wondering if the Developer uses the plug in to setup with their Google Account and All the Apps store the data in the same Developer's Spread Sheet... that way all the data from all users is in the same place consuming the developer's Google Drive space and all the data can be compared.

    So I was wondering where the PlayerPrefs "Cloud" data is stored.

    What I want is the second case, I want all the Users of the App to save data to the same Spreadsheet on my own Google Drive.

    Does the other plug in would work for that?
     
  6. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Ahh, that maks sense, thanks for the clarification. All my assets use the developer spreadsheets for storing the data.
     
    daville likes this.
  7. daville

    daville

    Joined:
    Aug 5, 2012
    Posts:
    303
    Just took a look at all your other assets, they look really interesting O_O have you considered bundle them all together as a complete suit with a discount?

    I still can't decide if Could Prefs or Google Sheets for unity is better for me in this case XD any Suggestion?
     
  8. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Actually, I do want to bundle them, and apply a discount, but Im waiting for the Asset Store to implement something that facilitates the task (there was something in the roadmap), because its a work that I dont want to rush, and neither have the time to do it by hand.

    My recommendation is that you should go with GSFU which is more of a generalist approach. But if you have already something implemented using Unity PlayerPrefs, would make sense to go with this one. Either way, if you pick and buy one, just poke me and I can provide you with the other for testing which one better suits your needs.
     
    daville likes this.
  9. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    Is the string also available?
     
  10. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    Hello.

    I'm using Google Cloud Unity Asset.

    I can not use this asset.

    Can you make it into video?

    And i SmallExample used... but error...

    ====================================================
    ArgumentException: JSON parse error: Invalid value.
    UnityEngine.JsonUtility.FromJson[Wrapper`1] (System.String json) (at C:/buildslave/unity/build/artifacts/generated/common/modules/JSONSerialize/JsonUtilityBindings.gen.cs:24)
    JsonHelper.JsonArray[PrefsObject] (System.String json) (at Assets/CloudPrefs/CloudPrefsConnector.cs:166)
    CloudPrefs.PlayerPrefs.LoadBuffer (System.String response, QueryType queryAction) (at Assets/CloudPrefs/PlayerPrefs.cs:309)
    UnityEngine.Events.InvokableCall`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:220)
    UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:634)
    UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:769)
    UnityEngine.Events.UnityEvent`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.String arg0, QueryType arg1) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_2.cs:53)
    CloudPrefsConnector+<ExecuteQuery>c__Iterator0.MoveNext () (at Assets/CloudPrefs/CloudPrefsConnector.cs:129)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    ======================================================
     
  11. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    I want...the google drive sheet web app code.

    And... ha... how do you use it? There is not enough explanation.
     
  12. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @tlsdudtj. It seems that you have not deployed the asset correctly, nor followed the Developer Guide. Please read the included PDF manual and follow the instructions on how to deploy and setup all what its required.

    If you have further questions, please contact me by email with your Unity Asset Astore invoice attached. Thanks.
     
  13. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    I send email. you read pls~
     
  14. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    How do I fix a Google gs file? You do not answer too much.
     
  15. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    I am waiting a lot of time ... If you will not give me a reply, please give me a message.
     
  16. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
    ...wait message or don't wait message??? ha...
     
  17. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9
  18. tlsdudtj

    tlsdudtj

    Joined:
    Feb 27, 2016
    Posts:
    9

    How did you use it? I'm in trouble for the third day. How did you resolve the Google Sheet Script?
     
  19. SaVe1418

    SaVe1418

    Joined:
    Jan 29, 2017
    Posts:
    6
    Hi Novack,

    interesting asset. I was thinking to buy this solution and use it to store playerprefs (players savegames) for our mobile game (for android and iOS). Few questions, does it store on our own developer sheets? Do we have access to the players saves and can we modify them? Is it secure? Can we send it encrypted as well? What are the limitations of this solution? (if any).

    Thank you in advance,
    SaVe
     
  20. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @SaVe1418,

    Yes, it stores all data in a single spreadsheet owned by the developer. Its already encrypted as it uses SSL. However this has limitations with the number of players using it. Keep in mind it is not a database solution, is a wrapper that enables you to save Unity PlayerPrefs in a Google spreadheet, so the potential limitations compared to a full blown database solution are on plain sight.
     
  21. PimajeXenja

    PimajeXenja

    Joined:
    Dec 31, 2014
    Posts:
    10
    Hello Novack! First I want to thank you for you awesome CloudPrefs program it is exactly what I need to solve my problem of keeping local player scores if they delete their game. I wanted to ask you about a problem I am having setting up CloudPrefs. I am getting a JSON error, specifically:

    Code (CSharp):
    1.     ArgumentException: JSON parse error: Invalid value.
    2.     UnityEngine.JsonUtility.FromJson[Wrapper`1] (System.String json) (at C:/buildslave/unity/build/artifacts/generated/common/modules/JSONSerialize/JsonUtilityBindings.gen.cs:24)
    3.     JsonHelper.JsonArray[PrefsObject] (System.String json) (at Assets/CloudPrefs/CloudPrefsConnector.cs:166)
    4.     CloudPrefs.PlayerPrefs.LoadBuffer (System.String response, QueryType queryAction) (at Assets/CloudPrefs/PlayerPrefs.cs:309)
    5.     UnityEngine.Events.InvokableCall`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:220)
    6.     UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:634)
    7.     UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:769)
    8.     UnityEngine.Events.UnityEvent`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.String arg0, QueryType arg1) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_2.cs:53)
    9.     CloudPrefsConnector+<ExecuteQuery>c__Iterator0.MoveNext () (at Assets/CloudPrefs/CloudPrefsConnector.cs:129)
    10.     UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    11.  
    Checking the forum it appears as though another, very nasty gentleman, had the same error, and you suggested that he did not set up and deploy correctly. As far as I can tell, I followed the directions to a "T" but it is obvious that I am missing something as others have successfully deployed with no problem. I was wondering if you could help me solve my dilemma. Here are the steps I have completed so far:

    • Made a test environment (did not try to add it to my game but started a new "test" unity project) and downloaded the asset
    • Read the PDF
    • Obtained a copy of the CloudPrefs connector google script
    • Tied the google script to the script editor
    • Changed the spreadsheet ID to the value between the "d/" and "edit" in the address bar
    • Saved the version
    • Successfully deployed as web app
    • Saved web app url into webserviceurl field
    • Used "run - doget" skipped the error but did not get the authorization to run (perhaps the error is here?)
    • Added the small example script to the camera and ran the project
    Any help would be greatly appreciated. Thank you in advance!
     
  22. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @PimajeXenja thanks for contacting.

    Thanks for a clear description of where you're standing. Im looking into it and will see how we can solve this situation, we'll be back briefly.
     
  23. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    It seems like I can reproduce your issue by using an incorrect spreadseet id on the web app script. So this seems to indicate either 2 things:

    1) you did not efectively changed the spreadsheet id as you thought.
    or
    2) you did changed the spreadsheet, but *after* having deployed the webapp, which means you need to deploy again, using a new project version, etc.

    In any case, doing the precise steps to deploy, you should be able to use the asset as expected.
     
  24. PimajeXenja

    PimajeXenja

    Joined:
    Dec 31, 2014
    Posts:
    10

    Thanks for your quick response Novack! I'm going to be out the country for a week or so but will get right on and and update you as soon as I return. Thanks again!
     
    Novack likes this.
  25. PimajeXenja

    PimajeXenja

    Joined:
    Dec 31, 2014
    Posts:
    10
    Completely forgot to get back to you but it is working now. I was putting the link for the connector in the spreadsheet id for whatever reason smh. Thanks!
     
    Novack likes this.
  26. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hi,

    A couple of quick questions. Firstly, how does the game handle a situation where the player is offline? Are the playerprefa saved locally and then uploaded the next time he runs the game online?

    Also, a typical player may be using as many as 300 player pref entries. Would this result in a spreadsheet that gets too big? Do google sheets have an upper limit and if so, what happens when this is reached?
     
  27. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Seems like a I missed a post! CloudPrefs allows you to also use standard Unity PlayerPrefs. So how you handle offline state is up to you, the asset only points to have a simple way for online prefs, but the strategy is still on your hands.

    Depending on the number of players, you shoulndt have issues with 300 prefs per player, but if you userbase grows you will be safer by going into a more elaborated solution like Playfab, etc.
     
  28. Homeak16

    Homeak16

    Joined:
    Feb 27, 2017
    Posts:
    19
    Hi,

    i'm developing a system what verify if your device have some videos, and if it doesn't, i want to download it from Google Drive.
    For every user videos is different, i want to make it as different folders on a Google Drive.

    So, before buying your asset, tell me please, if your asset can:
    1) Be connected to a default Drive without user interaction.
    2) Found a folder on Drive and download all .mp4 from it.

    Best regards,
    Homeak
     
  29. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @Homeak16, you're probably more interested on a different asset of the suite: CloudImages.

    Its not made for videos, but could potentially be reworked to do something like you need. However, its not a stock feature, and you would need to read a bit con the Google Script API in order to mod the web service to implement it.
     
  30. Homeak16

    Homeak16

    Joined:
    Feb 27, 2017
    Posts:
    19
    Hi, thx for reply.
    I know that it will be needed to be modified for video.
    CloudImages looks like what i need, but i want to know if user must login to gmail account to be able to download staff from Drive.
    This is one of main problems, user doesn't have to login or to do another actions to get files from drive.
    So, does CloudImages request a login from user or i can connect it to default mail in code?

    Edited
    I read about CloudImage, and if i will be able to change it for .mp4, and add search folder method and download all mp4 from folder, it's exactly what i need.
    Just tell me please if it's realisable in your plugin and if I can count on your help.


    Best regards
     
    Last edited: Dec 28, 2017
    Novack likes this.
  31. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    I read your email and found you actually made it work. Good luck!
     
  32. kend9u

    kend9u

    Joined:
    Jun 28, 2017
    Posts:
    2
    Does CloudPrefs works for Webgl on Facebook now?
     
  33. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hello @kend9u, no, Im afraid to the date, I have not worked on making it work with web deployment.
     
  34. kend9u

    kend9u

    Joined:
    Jun 28, 2017
    Posts:
    2
    Hi @Novack,
    That's too bad. Seems CloudPrefs is a good product. I just found out that my webgl playerprefs don't persist across browsers or different PCs. I was hoping that CloudPrefs would be that perfect solution.
    Thanks,
    Ken
     
    Novack likes this.
  35. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    @Everyone a quick fix/note:

    On late Unity versions the WebRequest API has been modified, and the Send() method has been marked as obsolete.
    This may result on annoying console warnings, and some people has even reported malfunctions.

    This affects all the Cloud Suite assets: Google Sheets For Unity, CloudPlayer, CloudConsole, CloudPrefs, and CloudImages.

    To fix this, until I can update the assets to new versions, please open the <*>Connector<*> class (naming varies depending the asset) and change the line:

    Code (CSharp):
    1. www.Send();
    to:
    Code (CSharp):
    1. www.SendWebRequest();
    Thats it for now, that should handle any issues until I can elaborate and a new version be released.
    Thanks!
     
  36. tomaz52

    tomaz52

    Joined:
    Feb 12, 2014
    Posts:
    22
    I have a problem with parse a json array :(, in the documentation says that i need go to http://forum.unity3d.com/threads/how-to-load-an-array-with-jsonutility.375735/
    But for me still get errors. I'm using unity 2017.4.3f1

    Error:
    ArgumentException: JSON parse error: Invalid value.
    UnityEngine.JsonUtility.FromJson[Wrapper`1] (System.String json) (at C:/buildslave/unity/build/artifacts/generated/common/modules/JSONSerialize/JsonUtilityBindings.gen.cs:25)
    JsonHelper.getJsonArray[PrefsObject] (System.String json) (at Assets/Boz/Scripts/Utils/JsonHelper.cs:12)
    CloudPrefs.PlayerPrefs.LoadBuffer (System.String response, QueryType queryAction) (at Assets/CloudPrefs/PlayerPrefs.cs:310)
    UnityEngine.Events.InvokableCall`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.String args0, QueryType args1) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:244)
    UnityEngine.Events.UnityEvent`2[System.String,CloudPrefsConnector+QueryType].Invoke (System.String arg0, QueryType arg1) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_2.cs:58)
    CloudPrefsConnector+<ExecuteQuery>c__Iterator0.MoveNext () (at Assets/CloudPrefs/CloudPrefsConnector.cs:129)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
     
  37. tomaz52

    tomaz52

    Joined:
    Feb 12, 2014
    Posts:
    22
    [Solved] Repeat all the doc steps, do all again and this time works!!
     
    Novack likes this.
  38. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Hey @tomaz52, sorry for the late response, today was The Universim release day on Steam, and we got a few pretty busy days at my dayjob :)

    Glad you solved it, and thanks for the review!
     
    Last edited: Aug 28, 2018
  39. tomaz52

    tomaz52

    Joined:
    Feb 12, 2014
    Posts:
    22
    Hello Novack :), can you help-me?

    If you delete the local playerprefs, You never may retrieve the cloud save :(.
    How can i retrieve the save prefs if local save is deleted?
    Like the example that came with your asset.

    private void DoSomeStuff()
    {
    // Check TestKey on the CloudPrefs buffer.
    bool test = PlayerPrefs.HasKey("TestKey", true);
    Debug.Log("TestKey exist on the cloud?: " + test);

    // Set TestKey on the CloudPrefs buffer.
    PlayerPrefs.SetInt("TestKey", 2, true);

    // Get TestKey from the CloudPrefs buffer.
    int testInt = PlayerPrefs.GetInt("TestKey", true);
    Debug.Log("Get me 'TestKey' value: " + testInt);

    // Save buffer to the cloud.
    PlayerPrefs.Save(true);
    }

    All works fine on this example, until i delete the key called "TestKey".
    On the next step if i want work again, i will need create the same "TestKey" again on the Spreadsheet, will repeat the same key (Like you can see on this image).
    If i creat a game, and install on a diferent computer, how can i retrieve the same playerprefs save that i save on another computer?
     

    Attached Files:

  40. tomaz52

    tomaz52

    Joined:
    Feb 12, 2014
    Posts:
    22
    Well, that's what you get when you buy this package.
    I spoke with developer to get undertud this package to use on a login sistem, i bought this package because his promisse is "store player preffs in the cloud", but if you try acess from another computer, dont work, and if you uninstall the game and install again, dont work no more, if you dont hold the "CloudPrefs_UID". To me he's selling a misleading advertisement. I ask my money back, but he dont respond no more :(
    I already gave him a bad review in the asset store.
     
  41. tomaz52

    tomaz52

    Joined:
    Feb 12, 2014
    Posts:
    22
    Unfortunately misleading advertisement, if you delete local prefs, your save is gone forever :(, you need store the "CloudPrefs_UID", but, even if store this id, you can restore your save from another computer.
     

    Attached Files:

    • 11.png
      11.png
      File size:
      150.4 KB
      Views:
      748
  42. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    I gave this person a good batch of time in support and reached a point where it was clear that the problem was a poor Unity and/or coding knowledge on the customer part.

    Its beyond my posibilities to write or review code for every single person using CloudPrefs. We reached a dead end when after many mails, I finally needed to explain this simple point to him.

    In return, he called me names, and started bashing the asset here and on the store page. Regreatbly, he also tried to start a new support request poorly disguising himself with a different mail address. All this questionable behavior speaks by itself.

    Among my stuff on the Unity Asset Store I have thousands of customers, using different assets that work under the same technical underlying principle, and the whole majority of people doesnt have the issues faced by this person, and enjoy and make good use of them.
     
    Last edited: Dec 26, 2018
  43. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
  44. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    841
    Heads up! From this day, this asset is being deprecated, in favour of the new main version of
    Google Sheets For Unity.

    Check the new asset details:
    [Forum Thread]
    [Store Page]