{"id":23752341,"url":"https://github.com/gilzoide/unity-cloud-save","last_synced_at":"2025-09-05T00:32:30.057Z","repository":{"id":269335035,"uuid":"907092515","full_name":"gilzoide/unity-cloud-save","owner":"gilzoide","description":"Cloud Save interface with implementations for Apple Game Center and Google Play Games","archived":false,"fork":false,"pushed_at":"2024-12-23T22:11:22.000Z","size":164,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-31T06:25:54.201Z","etag":null,"topics":["android","cloud-save","game-center","gamecenter","ios","macos","macosx","mobile","play-games","play-games-services","playgames","playgameservices","tvos","unity","unity3d","unity3d-plugin","upm","upm-package","visionos"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gilzoide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gilzoide"],"patreon":null,"open_collective":null,"ko_fi":"gilzoide","tidelift":null,"community_bridge":null,"liberapay":"gilzoide","issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-12-22T19:37:20.000Z","updated_at":"2024-12-28T01:44:05.000Z","dependencies_parsed_at":"2024-12-22T20:30:01.616Z","dependency_job_id":"82da6479-3619-4bbf-8f64-8b644bfc2b78","html_url":"https://github.com/gilzoide/unity-cloud-save","commit_stats":null,"previous_names":["gilzoide/unity-cloud-save"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-cloud-save","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-cloud-save/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-cloud-save/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-cloud-save/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilzoide","download_url":"https://codeload.github.com/gilzoide/unity-cloud-save/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232013763,"owners_count":18460451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","cloud-save","game-center","gamecenter","ios","macos","macosx","mobile","play-games","play-games-services","playgames","playgameservices","tvos","unity","unity3d","unity3d-plugin","upm","upm-package","visionos"],"created_at":"2024-12-31T17:28:34.834Z","updated_at":"2024-12-31T17:28:35.586Z","avatar_url":"https://github.com/gilzoide.png","language":"C#","readme":"# Cloud Save\nCloud Save interface with implementations for the Unity Editor, [Apple's Game Center](https://developer.apple.com/documentation/gamekit/saving-the-player-s-game-data-to-an-icloud-account) and [Google Play Games Services](https://developer.android.com/games/pgs/savedgames).\n\nFuture implementations might include [Unity Gaming Services](https://docs.unity.com/ugs/manual/cloud-save/manual), [Epic Online Services](https://dev.epicgames.com/docs/game-services/player-data-storage), [Steam Cloud](https://partner.steamgames.com/doc/features/cloud) and [Firebase Cloud Storage](https://firebase.google.com/docs/storage/unity/start).\n\n\u003e Note from *gilzoide*: since I work as a mobile game developer, iOS and Android support is enough for my needs.\n\u003e I will likely not work on the suggested future implementations in the mid term, unless this work is sponsored.\n\n\n## Features\n- Simple interface with async methods for fetching, loading, saving and deleting cloud save games\n- Single interface for all implementations, for easy multiplatform development\n- Supports the Unity Editor by saving files in the \"Library/Gilzoide.CloudSave\" folder\n- Supports macOS / iOS / tvOS / visionOS platforms using Game Center + iCloud\n- Supports Android platforms using Google Play Games Services\n\n\n## TODO\n- Store additional metadata in Game Center provider, retrieve last save date\n- Add support for choosing how to resolve conflicts between cloud saved games\n- Add a way to automate Game Center / iCloud capabilities in XCode project?\n\n\n## How to install\nEither:\n- Use the [openupm registry](https://openupm.com/) and install this package using the [openupm-cli](https://github.com/openupm/openupm-cli):\n  ```\n  openupm add com.gilzoide.cloud-save\n  ```\n- Install using the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html) with the following URL:\n  ```\n  https://github.com/gilzoide/unity-cloud-save.git#1.0.0-preview3\n  ```\n- Clone this repository or download a snapshot of it directly inside your project's `Assets` or `Packages` folder.\n\n\n## Usage example\n```cs\nusing System.Collections.Generic;\nusing Gilzoide.CloudSave;\nusing Gilzoide.CloudSave.Providers;\nusing UnityEngine;\n\npublic class MyCloudSaveBehaviour : MonoBehaviour\n{\n    void Start()\n    {\n        // 1. Instantiate the wanted cloud save provider implementation.\n        ICloudSaveProvider cloudSaveProvider;\n#if UNITY_EDITOR\n        // 1.a The Editor provider stores files in the \"Library/Gilzoide.CloudSave\" folder.\n        // This is not the folder one would usually store game save data, so it functions\n        // as a \"cloud save\" folder even after you clear regular save files or PlayerPrefs.\n        cloudSaveProvider = new EditorCloudSaveProvider();\n#elif UNITY_ANDROID \u0026\u0026 HAVE_GOOGLE_PLAY_GAMES\n        // 1.b Android + Google Play Games Services provider.\n        // Requires installing the Google Play Games plugin and setting it up first.\n        // You need to define the `HAVE_GOOGLE_PLAY_GAMES` scripting symbol on Android.\n        // Users must be logged in to Play Games for cloud save to work.\n        cloudSaveProvider = new PlayGamesCloudSaveProvider();\n#elif UNITY_STANDALONE_OSX || UNITY_IOS || UNITY_TVOS || UNITY_VISIONOS\n        // 1.c Apple Game Center provider (macOS, iOS, tvOS, visionOS).\n        // Requires defining the Game Center capability in XCode project.\n        // Requires defining the iCloud capability with the \"iCloud Documents\"\n        // checkbox enabled and an iCloud container configured in XCode.\n        // Users must be logged in to Game Center and iCloud for cloud save to work.\n        cloudSaveProvider = new GameCenterCloudSaveProvider();\n#else\n        // 1.d The Dummy provider does nothing and exists for use in unsupported platforms.\n        // Calling methods on it do not throw, but they also do not save anything.\n        cloudSaveProvider = new DummyCloudSaveProvider();\n#endif\n\n#if UNITY_ANDROID \u0026\u0026 HAVE_GOOGLE_PLAY_GAMES\n        // 2. Activate Play Games as the current Social provider in Unity.\n        // Alternativelly, use Play Games API directly instead of UnityEngine.Social\n        GooglePlayGames.PlayGamesPlatform.Activate();\n#endif\n\n        // 3. Make sure user is logged in to Play Games / Game Center before using cloud save.\n        // This is not required by the Editor implementation.\n        if (Social.localUser.authenticated)\n        {\n            DoSomethingWithCloudSave(cloudSaveProvider);\n        }\n        else\n        {\n            Social.localUser.Authenticate((success, message) =\u003e\n            {\n                if (success)\n                {\n                    DoSomethingWithCloudSave(cloudSaveProvider);\n                }\n                else\n                {\n                    Debug.LogError($\"Social authenticate error: {message}\");\n                }\n            });\n        }\n    }\n\n    async void DoSomethingWithCloudSave(ICloudSaveProvider cloudSaveProvider)\n    {\n        // 4. Check if cloud save is enabled before using cloud save functionality.\n        // Some providers require logging in to a social account before using cloud save.\n        // Providers will likely throw exceptions on operations when cloud save is not enabled.\n        if (!cloudSaveProvider.IsCloudSaveEnabled)\n        {\n            return;\n        }\n\n        // 5. Now do something with the cloud save provider\n        List\u003cICloudSaveGameMetadata\u003e savedGames = await cloudSaveProvider.FetchAllAsync();\n        foreach (ICloudSaveGameMetadata savedGame in savedGames)\n        {\n            Debug.Log($\"Found saved game with name {savedGame.Name}\");\n        }\n\n        await cloudSaveProvider.SaveTextAsync(\"SaveText\", \"Sample text data\");\n        await cloudSaveProvider.SaveBytesAsync(\"SaveBytes\", new byte[] { 1, 2, 3, 4 });\n        await cloudSaveProvider.SaveJsonAsync(\"SaveJson\", new Vector3(1, 2, 3));\n\n        string savedText = await cloudSaveProvider.LoadTextAsync(\"SaveText\");\n        byte[] savedBytes = await cloudSaveProvider.LoadBytesAsync(\"SaveBytes\");\n        Vector3 savedJson = await cloudSaveProvider.LoadJsonAsync\u003cVector3\u003e(\"SaveJson\");\n\n        await cloudSaveProvider.DeleteAsync(\"SaveText\");\n    }\n}\n```\n\n\n## Game Center\n- Game Center is supported on macOS, iOS, tvOS and visionOS platforms.\n- You must add the Game Center capability to the XCode project.\n- You must add the iCloud capability to the XCode project.\n  The \"iCloud Documents\" checkbox must be enabled and an iCloud container must be configured for the cloud save to work.\n- The user must be signed in to Game Center and have iCloud Drive enabled in their account for cloud save to work.\n\n\n## Google Play Games Services\n- Play Games is supported on Android platforms\n- You must install the [Google Play Games plugin for Unity](https://github.com/playgameservices/play-games-plugin-for-unity) in your project.\n  If you use an old version of the plugin that does not come with Assembly Definition files, create the `Google.Play.Games` asmdef in the plugin's root folder, as well as the `Google.Play.Games.Editor` editor-only asmdef on the plugin's \"Editor\" folder.\n- You must define the `HAVE_GOOGLE_PLAY_GAMES` [custom scripting symbol](https://docs.unity3d.com/Manual/custom-scripting-symbols.html).\n  This package needs this to avoid compilation errors when Google Play Games plugin is not installed.\n- The user must be signed in to Play Games for the cloud save to work\n","funding_links":["https://github.com/sponsors/gilzoide","https://ko-fi.com/gilzoide","https://liberapay.com/gilzoide"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-cloud-save","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilzoide%2Funity-cloud-save","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-cloud-save/lists"}