Working With Assets in Game
This page deals only with Assets on a game level. To learn about assets on a player lavel, check out Working With Assets for Player in Game how-to

Retrieve Assets

To start retrieving assets you can run following:
Unity
int count = 10;
LootLockerSDKManager.GetAssetListWithCount(count, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved " + response.assets.Length + " assets");
}
else
{
Debug.Log("Error retrieving assets");
}
});
After the initial method has completed retrieving assets you can call this method to get more:
Unity
LootLockerSDKManager.GetAssetNextList(count, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved second batch of " + response.assets.Length + " assets");
}
else
{
Debug.Log("Error retrieving assets");
}
});
If you want to retrieve all you asets you can keep calling the method until you stop receiving assets.
After finishing retrieving the assets you need, it's best practice to run the following code, as if you try to get assets later, you might start from your previous last retrieved asset.
Unity
LootLockerSDKManager.ResetAssetCalls();

Retrieve Assets With Filter

Unity
int count = 10;
List<LootLocker.LootLockerEnums.AssetFilter> filter = new List<LootLocker.LootLockerEnums.AssetFilter>() { LootLocker.LootLockerEnums.AssetFilter.nonpurchasable };
LootLockerSDKManager.GetAssetListWithCount(count, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved " + response.assets.Length + " assets");
}
else
{
Debug.Log("Error retrieving assets");
}
}, filter);

Retrieve Assets by IDs

If you already know the IDs of the assets you wish to get, you can use this method to retrieve them specifically.
Unity
string[] list = new string[] { "8111" };
LootLockerSDKManager.GetAssetsById(list, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved " + response.assets.Length + " assets");
Debug.Log("First Asset ID: " + response.assets[0].id);
}
else
{
Debug.Log("Error retrieving assets");
}
});

Retrieve Favorite Assets

Unity
LootLockerSDKManager.ListFavouriteAssets((response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved " + response.favourites.Length + " assets");
if (response.favourites.Length > 0)
{
Debug.Log("First Asset ID: " + response.favourites[0]);
} else
{
Debug.Log("No favourite assets");
}
}
else
{
Debug.Log("Error retrieving assets");
}
});

Add Favorite Asset

Unity
LootLockerSDKManager.AddFavouriteAsset("8111", (response) =>
{
if (response.success)
{
Debug.Log("Successfully favourited asset");
}
else
{
Debug.Log("Error favouriting asset");
}
});

Remove Favorite Asset

Unity
LootLockerSDKManager.RemoveFavouriteAsset("8111", (response) =>
{
if (response.success)
{
Debug.Log("Successfully removed favourite asset");
}
else
{
Debug.Log("Error removing favourite asset");
}
});
Copy link
On this page
Retrieve Assets
Retrieve Assets With Filter
Retrieve Assets by IDs
Retrieve Favorite Assets
Add Favorite Asset
Remove Favorite Asset