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
CloudServicesSetValue
Save data to cloud
CloudServicesSynchronize
Trigger sync with cloud
Variables Needed
currentLevel (Int)
totalScore (Long)
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 (Long)
Save Name:
key: "player_name"
value: playerName (String)
Transition: Go to Synchronize
2. State: Synchronize
Action: CloudServicesSynchronize
Events:
successEvent β ShowSaveSuccess
failureEvent β ShowSyncError
Save Flow
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
Save on Events: Save after meaningful progress (level complete, achievement)
Don't Over-Sync: Batch changes, sync once per session or on pause
Handle Conflicts: Listen to OnSavedDataChange for remote updates
Test Offline: Verify data queues for sync when back online
Last updated
Was this helpful?