Documentation

​
​

Development

User Acquisition

Monetization

Industry

Cloud Save

Unity SDK

Admin API

Client API

Open Unity Dashboard

Cloud Save

LiveOps
​
​
Cloud Save
  • Overview
  • Get started
  • Concepts
    • Player Data
    • Game Data
    • Files
    • Queries
    • Write locks
  • Tutorials
  • Reference
  • Privacy and consent
  1. Cloud Save

Write locks

Understand how write locks prevent you from overwriting changes made to data from other sources.
Read time 1 minute
Last updated 8 months ago

Write locks ensure that when you update a data item, you can't overwrite changes from somewhere else. For example, if there are changes in a different part of your code, or from a Cloud Code script.
For an example of how to use a write lock, refer to the
SaveItem
class
in the Cloud Save SDK.

Enforces conflict checks

Read and write commands both return a
writeLock
, which you can store locally. When you save a value, you can include the
writeLock
that you obtained. If the write lock doesn't match what's in the Cloud Save service, the service returns an error to indicate that the value in the service has been updated since the last time you retrieved the write lock.

Conflict resolution

If you encounter a write lock error, you can proceed with one of the following:
  • If you're certain the value you want to save is correct, you can bypass the write lock to overwrite any changes.
  • To update the value and write lock from the Cloud Save service, read the value again. You can then manually resolve the conflict.

Write lock omission

Item creation

To avoid unnecessary errors, you need to omit the
writeLock
field when you create a new data item.

Overwrite changes

To skip write lock validation, you can set the
writeLock
field for an item to
null
. A null write lock means that you overwrite any existing value stored for that item.

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Enforces conflict checks

      • Conflict resolution

    • Write lock omission

      • Item creation

      • Overwrite changes


Report a problem with this page