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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[RELEASED] CloudOnce | Unified Game Services API

Discussion in 'Assets and Asset Store' started by Trollpants, May 6, 2015.

  1. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @elmar1028,

    Here is a simple example of how you can use Cloud Save:
    Code (CSharp):
    1. using Trollpants.CloudOnce.CloudPrefs;
    2. using UnityEngine;
    3.  
    4. public class CloudStringExample : MonoBehaviour
    5. {
    6.     CloudString myString = new CloudString("stringId");
    7.  
    8.     private string MyString
    9.     {
    10.         get { return myString.Value; }
    11.         set { myString.Value = value; }
    12.     }
    13.  
    14.     private void Start()
    15.     {
    16.         MyString = "This is my string, there are many like it," +
    17.                    " but this one is mine.";
    18.  
    19.         Debug.Log(MyString);
    20.     }
    21. }
    22.  
    - Jan Ivar
     
    Last edited: Sep 10, 2015
  2. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Hi,

    I'm trying to get your plugin up and running but I'm having trouble understanding your initialisation script at http://trollpants.com/cloudonce/initialSetup.html

    Why do you have a comment saying "// Do anything that requires CloudOnce to be initialized, e.g." in the "CloudOnceInitializeComplete()" method? I mean, shouldn't one have done that before actually arriving at
    "CloudOnceInitializeComplete()" ?

    And what does "CloudOnceStartupComplete" refer to? A method somewhere?

    TIA
     
  3. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Ok, so now I've tried adding Quick Start Scripts/InitializeCloudOnce on my Main GameObject
    and added LeaderboardsButton.cs to a button.

    I have added a few achievements and a highscore leaderboard.

    Xcode then fails compiling with these errors.
    Undefined symbols for architecture arm64:
    "_OBJC_CLASS_$_GKAchievement", referenced from:
    objc-class-ref in CloudOnceAchievements.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    if I disable arm64 from Unity I get the same error with arm7
     
    Last edited: Aug 24, 2015
  4. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @summerian, have you added GameKit in xcode?

    - Jan Ivar
     
    Last edited: Sep 10, 2015
  5. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Hey,

    Thanks, that fixed the compilation error.

    Then when I clicked the Leader Board Button I would another error saying:
    NSUbiquitousKeyValueStore error has no valid com.apple.developer.ubiquity-kvstore-identifier entitlement

    So besides Game Centre Capabilities I also turned on iCloud.

    Now when I click on the button I get:

    2015-08-25 12:50:51.170 myapp[328:66499] Get string with key: TrollpantsDevString
    2015-08-25 12:50:51.171 myapp[328:66499] Getting dev string TrollpantsDevString
    2015-08-25 12:50:51.171 myapp[328:66499] Returning string:

    Is there still something I need to do? And is it correct that I should turn on iCloud capabilities?
     
  6. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Last edited: Sep 10, 2015
  7. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.5.2 is now on-line on the asset store!

    Release Notes
    -------------
    - Improved Android device compatibility
    - Fixed deserialization of old cloud currency data
    - Fixed bug related to saving cloud currency
    - Prepared more files for Unity 4.3 compatibility update

    - Jan Ivar
     
    Last edited: Sep 10, 2015
  8. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    Thanks for the reply. I'll try that out and thanks for the update too. :)
     
  9. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Hello,

    Do I need to do anything before I download an update?

    Thanks!
     
  10. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    @elmar1028 This is the safest way to upgrade:
    1. Back up SerializedCloudConfig file
    2. Delete the CloudOnce folder in Extensions
    3. Import the new package (deselect the Plugins folder when importing)
    4. Put back the SerializedCloudConfig file
    5. Save configuration in the CloudOnce Editor
    The update will likely be on-line on the asset store within 2-5 business days, as it needs to go through Unity's review process.

    v1.6.0 will include an automatic upgrader so that this sort of thing is no longer necessary. The biggest part of the v1.6.0 update is that I am rewriting the editor almost from scratch, and it's looking really good so far :) The other big feature in v1.6.0 is Unity 4.3 support. Most of the work on that is already done, but we need to properly test it.

    - Jan Ivar
     
    Last edited: Sep 10, 2015
    elmar1028 likes this.
  11. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
    Hi,

    Thanks for the reply!

    Before you publish an update to the asset store there is a bug that always shows "Using Fake Cloud Provider" everytime a code is compiled.
    It's not a disaster, but annoys a bit :p
     
  12. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    @elmar1028 I'll try to do something about that in the next update ;)

    - Jan Ivar
     
    Last edited: Sep 10, 2015
  13. Amir-Ward

    Amir-Ward

    Joined:
    Jan 26, 2015
    Posts:
    30
    Hello, I installed this plugin yesterday and can get the native leaderboard UI's to work. I was wondering, how would I go about retrieving information from the leaderboard to display in my own custom GUI?
     
  14. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    @Amir Ward We currently don't have a unified API for custom GUI leaderboards, but this is something we are looking into adding in a future update.

    - Jan Ivar
     
    Last edited: Sep 10, 2015
  15. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.6.0 has been submitted to the Asset Store!

    Release Notes
    -------------
    - New dockable editor with responsive design
    - Cloud variables can now be declared in editor and are easily accessed from any script in any scene
    - Added support for Unity 4.3.4 and up
    - New automatic upgrader to delete obsolete files
    - New automatic addition of GameKit to plist after iOS builds
    - New unified API for PlayerID, PlayerDisplayName and PlayerImage
    - New "Deactivate On Event" quick start script
    - New "Load Scene On Event" quick start script
    - Re-added default value support for cloud currency types
    - Added Highest and Lowest persistence types support to CloudString
    - Improved Achievement- and Leaderboard Overlay button scripts
    - Unity Editor test data can now be easily deleted from CloudOnce Editor
    - NO_GPGS build symbol now automatically added on load for iOS
    - Moved GameCircle plug-in assets into Android Library project
    - Moved settings file to ProjectSettings folder

    The Getting Started guides will be updated to reflect the changes when the update goes on-line. I intend to make the guides much more comprehensive, and create an example project, but it may take some time.

    - Jan Ivar
     
    Last edited: Sep 10, 2015
  16. oguztecimer

    oguztecimer

    Joined:
    Mar 14, 2013
    Posts:
    4
    Hi,
    Fist of all thanks for this great asset. It's been really helpful on our project. I am wondering if it is possible to get usets gplay data (like profile picture, display name, etc.) with CloudOnce. Seems like it doesn't, but it wouldn't be efficient to use another plugin just for this when CloudOnce is already handling other stuff.
    What would you suggest?

    Thanks,
    Oguz
     
  17. kgtan

    kgtan

    Joined:
    Apr 28, 2015
    Posts:
    10
    So glad that this plugin is in active development!

    I got two questions...

    FIRST QUESTION
    1. Load = loads new cloud data (but does not attempt to save any new values from local to remote)
    2. Save = saves new cloud values (but does not attempt to download any new values from remote to local)

    I dunno if I'm interpreting the functions correctly or not, but what I want is more like a "Sync":

    3. Sync = like "Save", but also provide a callback for "OnSyncComplete" so the newest data is updated both locally and on the cloud

    This will save me from having to call both Save and Load (unless Save or Load is already like Sync?)

    SECOND QUESTION
    Is it possible to manually specify "PlayerPrefs-only" on the save method? I might need it to optimise the battery on my device. That way, I can save on playerprefs often, but only save onto the cloud in the OnApplicationPause or OnApplicationQuit functions.

    Cheers, and thanks for the great work!
     
  18. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    @oguztecimer I responded to your email.

    @kgtan First question: In most cases I would say that it isn't necessary to call on Load. The system loads automatically after initialization and since one user can only really play on one device at a time, chances are the cloud data won't be altered while the user is playing. So it should be safe to only call on Save. However if you want to be absolutely certain you'll have to call on Load, then Save. When OnCloudSaveComplete is called you can be sure that both local and cloud has the newest data.

    Second question: The only way to do that would be to call on DataManager.SaveToDisk(). The DataManager class is in the Internal namespace, so you'll have to add "using Trollpants.CloudOnce.Internal;" to the file where you want to use it. This method was designed to only be called within the internal system, so I won't guaranty that it will work as you expect, but I believe it will work.

    - Jan Ivar
     
  19. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    I found a couple problems in the v1.6.0 update, so I had to re-submit the package to Asset Store, adding a little more time to the review process. I have updated the release notes in the post above to reflect the changes.

    - Jan Ivar
     
  20. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.6.0 is on-line on the asset store :) Quick dev update:

    I'm currently working on the update for the website. The guides will be updated with the new features first. That should be done in a day or two. It's taking a while because I'm cleaning up the HTML/CSS and adding better navigation to some of the pages.

    After that is done I think I'll work on expanding the guides with more info about the dev consoles and xcode. I've also gotten a couple of feature requests for CloudOnce I'll try to implement.

    - Jan Ivar
     
  21. slowdev1

    slowdev1

    Joined:
    Sep 12, 2011
    Posts:
    35
    Hi Trollpants,

    Thanks for CloudOnce. Will you be able to include a sample full event listener to the package? I'm having a hard time trying to implement cloud for Google Play fully like I used to with the old app state cloud using other Google Play assets. With an event listener, I can debug much more easily.

    Thanks!
     
  22. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @killerbean, please send an email explaining in detail how the feature would work, and I'll see if I can make it happen :)

    - Jan Ivar
     
  23. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    It looks like the website/documentation update won't be done before early next week. I'll be gone for a few days visiting family. The new Getting Started guide is really shaping up though. Trust me, it'll be worth the wait :)

    - Jan Ivar
     
  24. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,353
  25. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Thank you very much for your review @elmar1028! :)
     
    elmar1028 likes this.
  26. kim-il-jung

    kim-il-jung

    Joined:
    Sep 20, 2015
    Posts:
    1
    /// <summary>
    /// Not implemented yet. Calls the callback with an empty list.
    /// </summary>
    public void LoadScores(string leaderboardID, Action<IScore[]> callback)
    {
    Logger.w("PlayGamesPlatform.LoadScores not implemented.");
    if (callback != null)
    {
    callback.Invoke(new IScore[0]);
    }
    }

    readerboard에 있는 점수를 불러오는 기능이 구현되지 않은것 같습니다.
    맞나요?
    점수를 불러오는 기능은 있어야 되지 않을까요?
     
  27. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    @kim il jung That code is from the official Google Play Game Services plug-in. Google has not yet implemented that method, but most people don't need it, and CloudOnce doesn't have any unified API for it yet either. I'm sorry it's pretty hard to understand what you're asking as I had to Google Translate your question. If I didn't answer your question, please try to write it in English.

    - Jan Ivar
     
  28. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Last edited: Sep 22, 2015
  29. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Development update 24.09.2015

    With the new Getting Started guide complete, I've begun work on v1.6.1 (may become v1.7.0 before I'm done).
    Highlights include:
    • OnNewCloudValues now returns string array with the internal IDs for the changed values, any methods subscribed to this event will have to be updated
    • Option to specify leaderboard ID when showing native overlay, to be sent directly to specified leaderboard
    • Update official GPGS plug-in to v0.9.25
    • Ability to add GameCircle API key through CloudOnce editor
    • Fix compatibility issues with new GameCircle Android Library
    • Fix login bug on Google Play when checking IsSignedIn before calling Initialize method
    • Simulate Google Sign In/Out button in editor
    - Jan Ivar
     
  30. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.7.0 is on-line on the asset store!

    Release Notes
    • Added option to be sent directly to specified leaderboard overlay
    • Added string array of changed internal IDs to OnNewCloudValues event, any methods subscribed to this event will have to be updated
    • GameCircle API key is now added through CloudOnce editor
    • Updated GPGS plugin from v0.9.21 to v0.9.25
    • Added simulation of Google Sign In/Out button in editor
    • Fixed compatibility issues with new GameCircle Android Library
    • Fixed login bug on Google Play when checking IsSignedIn before calling Initialize method
    • Cleaned up Amazon GameCircle debug logs
    • Required Unity version raised to v4.5.5 to ensure GPGS compatibility
    - Jan Ivar
     
    Last edited: Oct 8, 2015
  31. reporter500

    reporter500

    Joined:
    Mar 4, 2015
    Posts:
    2
    I just completed a project using CloudOnce for an IOS application. I'm not trying to get it to work for the same project but targeted for Android this time. Everytime I try to run the Settings "Run Setup" button, I get the error message "Google Play Services Library Project Not Found". Can you please help me figure this out.
     
  32. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    You need to install the Google Play services library with the SDK Manager in the Android SDK. You will find the SDK Manager in the root of the Android SDK. Just start it, scroll down to the bottom of the list, check "Google Play services" and click the install button.

    - Jan Ivar
     
  33. reporter500

    reporter500

    Joined:
    Mar 4, 2015
    Posts:
    2
    That was it! Thanks.
     
  34. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.7.1 is on-line on the asset store!

    Release Notes
    -------------
    - Added unified API for LoadScores method
    - Updated GPGS plugin from v0.9.25 to v0.9.26

    - Jan Ivar
     
    Last edited: Nov 13, 2015
  35. DASOMJEON

    DASOMJEON

    Joined:
    Dec 6, 2013
    Posts:
    20
    Hello.
    I've just bought your asset and tried to initialize.
    In Mac debug mode, I can get the message, "OnInitializeComplete", cloud datas as well.
    But when I build apk and put it in my device(kindle fire hdx), It doesn't work.
    Initialization fails and I can't contact to the leaderboads, achievements, whispersync.
    Can you find what's the problem?
    I hope to hear your answer soon.
    Thanks.
     
  36. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
  37. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.7.2 has been submitted to the Asset Store!

    Release Notes
    -------------
    - Added dummy cloud provider to avoid exceptions when building to unsupported platforms
    - Updated GPGS plugin from v0.9.26 to v0.9.27

    - Jan Ivar
     
  38. opertoonist

    opertoonist

    Joined:
    Jul 11, 2012
    Posts:
    248
    Hello—I was hoping when I purchased the asset that I'd be able to store JSON in the string variables, but so far I haven't been able to get this to work, I assume because all of the variables are themselves being turned into JSON when they are stored. Is there any kind of workaround for this? Thanks.
     
  39. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @opertoonist, I believe you are correct about what is the likely issue. One solution would be to convert your JSON string into a base64 string before you save it to a CloudString. There are two extension methods in the class CloudOnceUtils you could use to easily do this (ToBase64String & FromBase64StringToString). You will need to add the following using directive to gain access to them:
    Code (CSharp):
    1. using Trollpants.CloudOnce.Internal.Utils;
    - Jan Ivar
     
  40. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    70
    Hi Jan/Mr Trollpants,
    I want to say a big thank you for this great assett! It's one of the best I've ever bought, along with Adventure Creator.
    Actually, I'd like these to work together, making AC saves cloud save compatible. I created an issue about it on AC-forums 3 months ago ( http://www.adventurecreator.org/forum/discussion/3716/ac-with-cloud-save-cloudonce-integration ) but havent yet solved it. Havent spent time on it either, as the project has been frozen for a while for me.

    The AC-saves can be stored in XML-format, and I wonder if I should try to save the string version of the XML as a cloud save, possibly using "ToBase64String & FromBase64StringToString" as mentioned above. Do you have comments about integrating savegames from AC?


    Oh and one other thing.. have you considered implementing the Google Game gifts support in cloudonce? That feature hasnt been seen much yet, but I believe it to be a game changer in the future. Here is some discussion about it for the "Google Play Games plugin for Unity"
    https://github.com/playgameservices/play-games-plugin-for-unity/issues/786

    Personally I would be very happy to see it even just for Google Play (evethough Im interested in Amazon+iOS too).
     
  41. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @ilmario, I haven't tested storing an XML string, but you should be able to store it directly in a CloudString without the base64 conversion. If there is a problem though, that would likely solve it. Have you checked out the (relatively) new getting started guide? It's way better than the previous documentation. Here is a direct link to the Cloud Save section: http://trollpants.com/cloudonce/gettingStarted.html#cloud-save

    Concerning the gifting, that is unfortunately outside of the scope of CloudOnce. Should all of our supported platforms decide to implement it in their services, I'll definitely take a look at it. That is unlikely however, as Amazon seems to have abandoned development on GameCircle. There hasn't been an update in well over a year from them. I actually had to update their implementation myself to make it compatible with the newer versions of Unity.

    - Jan Ivar
     
  42. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    70
    Thanks for your fast response! I will write later if I encounter trouble with AC save games, but it'll take a while, concentrating on other work.

    About the gifting.. I understand you want to concentrate on what can be implemented on all platforms. It means I need to use another assett for that part, but that is fine as long as cloudonce doesnt collide with the other one. Might try this one: https://www.assetstore.unity3d.com/en/#!/content/10825 .

    In any case Cloudonce is a fantastic (time)saver for my projects :)!
    EDIT: and thanks for the link to updated documentation, makes my life easier!
     
  43. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    No problem :) The asset you linked is likely to not be compatible with CloudOnce. I'll do some research and get back to you.

    EDIT: That asset does appear to currently be one of the only choices for Game Gifts. Hopefully Google will include an implementation in their official Unity plug-in soon.

    - Jan Ivar
     
    Last edited: Dec 2, 2015
  44. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    70
    It seems that asset is most likely required to implement game gifts. They also seem to be planning to implement app-invites, which is (a similar) very recent addition to google play services. App-invites is also something I could use with or instead of gifts:
    https://developers.google.com/app-invites/

    Its surprising Google's official Unity plugin doesnt seem to bother implementing either of these, gifts or app-invites.

    In any case, I'd much rather implement everything with the fantasic workflow of cloudonce. But as it doesnt seem likely, do you see any chance the imcompatibility issues between the modules can be avoided somehow with a patch or something?
     
  45. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    This is pure guesswork as I don't know how the other asset is structured. But the only probable conflict is that both assets will be using some of the same android libraries. So if you're lucky, all you'll need to do is make sure you don't import the same libraries more than once (check for .jar files with the same name if both packages). If there are issues, I'd contact the support team for the other asset and ask if there is any way of only importing the specific features you need for your project. I'm sure they will be happy to help! :)

    - Jan Ivar
     
  46. ilmario

    ilmario

    Joined:
    Feb 16, 2015
    Posts:
    70
    Ok, thank you again for the comments.
     
  47. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.7.3 has been submitted to the Asset Store!

    Release Notes
    -------------
    - Unity 5.3 compatibility

    - Jan Ivar
     
  48. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Version 1.7.4 has been submitted to the Asset Store!

    Release Notes
    -------------
    - Unity 4.7 compatibility

    - Jan Ivar
     
  49. zmeinaz

    zmeinaz

    Joined:
    Jul 3, 2012
    Posts:
    27
    Hi Jan,

    I am considering purchasing this asset, but I have fully implemented my game with Easy Save 2 for saving. I have large tile maps that are saved to files. Is it possible to save/load entire files to the cloud using this asset?
     
  50. Trollpants

    Trollpants

    Joined:
    Jun 22, 2014
    Posts:
    113
    Hi @zmeinaz,
    Yes, you can do it if it's possible to convert the files into strings. If you end up buying CloudOnce, I would still recommend (if possible) that you switch to using the pre-made cloud variable types available. If you only use strings, you don't get the benefit of the data conflict resolution the other types support.

    - Jan Ivar