Luna::Asset::get_asset

asset_t get_asset(const Guid &guid=Guid(0, 0))

Gets the asset handle from one asset GUID. If the asset entry with the specified GUID does not exist, this function creates one new asset entry with the specified GUID and returns the handle to the new created asset entry.

Asset handles created by get_asset is in unregistered state ( get_asset_state returns AssetState::unregistered). The user should call register_asset on the handle to register the asset before she can really use the asset. The user can also call new_asset to create and register asset in one call.

Parameters

  • in guid

    The asset GUID to fetch. If this is (0, 0), the system generates a random asset GUID, so that one new asset entry is always created and returned.

Return value

Returns the asset handle with the specified GUID.