Description
The ResourceVersion
property represents the version of the component within the GameResource
class. It is utilized by the JsonUpgrader
to manage versioning and upgrading of serialized data. This property is marked with the JsonIgnore
attribute, indicating that it should not be included in JSON serialization processes. Additionally, it is hidden from the inspector view due to the Hide
attribute.
Usage
Use the ResourceVersion
property to track and manage the version of a game resource component. This is particularly useful when dealing with serialization and deserialization processes where version control is necessary to ensure compatibility and data integrity.
Example
// Example of accessing the ResourceVersion property
public class MyGameResource : GameResource
{
public void CheckVersion()
{
int version = this.ResourceVersion;
// Perform operations based on the version
if (version < 2)
{
// Upgrade logic for older versions
}
}
}