ModAsset
See the code atresources/mod_asset.gd
Description
Inherits Resource
The ModAsset
class represents an asset associated with a Mod
, containing a unique identifier (key
) and a reference to a loaded resource (asset
).
The ModAsset
is loaded once per associated Mod
, ensuring that all instances of the mod share the same resource. This approach simplifies asset management by allowing developers to reference assets by their key
rather than worrying about individual loading or file paths.
Properties
key
@export var key: String
An identifier for the asset, unique to the containing Mod
.
Type | String |
---|
asset
@export var asset: Resource
The resource associated with the asset.
Type
Resource
Methods
create
static func create(key_value: String, asset_value: Resource) -> ModAsset
Constructs a new ModAsset
with the given key
and asset
.
This is a static method that can be called directly on the ModAsset
class. It creates a new ModAsset
instance, assigns the provided key
and asset
to the corresponding properties, and returns the created ModAsset
object.
Parameters
Name | Type | Description |
---|---|---|
key_value | String | The identifier for the asset. |
asset_value | Resource | The resource associated with the asset. |
Returns
ModAsset