int ApiVersion { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The ApiVersion property of the Package class is an integer that represents the API version of the package. This property is crucial for ensuring compatibility between game extensions and the game itself. Extensions targeting a specific game are only compatible if their API versions match. This helps maintain stability and functionality across different versions of the game and its extensions.

Usage

To access the ApiVersion property, you need to have an instance of the Package class. You can then retrieve the API version of the package to check for compatibility with the current game version.

Example

// Example of accessing the ApiVersion property

// Assume 'package' is an instance of Sandbox.Package
int apiVersion = package.ApiVersion;

// Check if the package is compatible with the current game version
if (apiVersion == currentGameApiVersion)
{
    // The package is compatible
}
else
{
    // The package is not compatible
}