Description
The Package
property of the Editor.Asset
class provides information about the package from which the asset was downloaded, if applicable. This property is particularly useful for assets that have been downloaded from the sbox.game platform. If the asset was not downloaded from sbox.game, this property will return null
.
Usage
To access the package information of an asset, you can use the Package
property. This is a read-only property and will return a Sandbox.Package
object if the asset was downloaded from sbox.game, or null
otherwise.
Example
// Example of accessing the Package property
Editor.Asset asset = GetAsset(); // Assume GetAsset() returns an instance of Editor.Asset
Sandbox.Package package = asset.Package;
if (package != null)
{
// The asset was downloaded from sbox.game
Console.WriteLine($"Asset is part of package: {package.Name}");
}
else
{
// The asset was not downloaded from sbox.game
Console.WriteLine("Asset is not part of any package.");
}