> For the complete documentation index, see [llms.txt](https://assetstore.essentialkit.voxelbusters.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://assetstore.essentialkit.voxelbusters.com/features/cloud-services/playmaker/use-cases/use-case-1-save-progress.md).

# Save Player Progress to Cloud

## Goal

Save player progress (level, score, settings) to iCloud or Google Play Games cloud storage for cross-device sync.

## Actions Required

| Action                   | Purpose                 |
| ------------------------ | ----------------------- |
| CloudServicesSetValue    | Save data to cloud      |
| CloudServicesSynchronize | Trigger sync with cloud |

## Variables Needed

* currentLevel (Int)
* totalScore (Int)
* playerName (String)

## Implementation Steps

### 1. State: SaveData

**Action:** CloudServicesSetValue (call multiple times for different keys)

* **Save Level:**
  * key: "player\_level"
  * value: currentLevel (Int)
* **Save Score:**
  * key: "total\_score"
  * value: totalScore (Int)
* **Save Name:**
  * key: "player\_name"
  * value: playerName (String)

**Transition:** Go to Synchronize

### 2. State: Synchronize

**Action:** CloudServicesSynchronize

* **Events:**
  * successEvent → ShowSaveSuccess
  * failureEvent → ShowSyncError

## Save Flow

```
SaveData
    ├─ SetValue("player_level", 10)
    ├─ SetValue("total_score", 5000)
    └─ SetValue("player_name", "Player1")
└─ Synchronize
    ├─ successEvent → ShowSaveSuccess
    └─ failureEvent → ShowSyncError
```

## Common Issues

* **Cloud Not Available**: User not signed into iCloud/Google account
* **Sync Delays**: Changes may take seconds to propagate
* **Data Conflicts**: Handle OnSavedDataChange for conflicts
* **Storage Limits**: iCloud limited to \~1MB per key

## Platform Differences

**iOS (iCloud):**

* Requires iCloud capability enabled
* User must be signed into iCloud
* Automatic sync when online

**Android (Google Play Games):**

* Saved Games API
* User must be signed into Google Play
* Manual sync trigger recommended

## Best Practices

1. **Save on Events**: Save after meaningful progress (level complete, achievement)
2. **Don't Over-Sync**: Batch changes, sync once per session or on pause
3. **Handle Conflicts**: Listen to OnSavedDataChange for remote updates
4. **Test Offline**: Verify data queues for sync when back online


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://assetstore.essentialkit.voxelbusters.com/features/cloud-services/playmaker/use-cases/use-case-1-save-progress.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
