Work with Files In-Game
Last updated
Last updated
Retrieve All Player Files
LootLockerSDKManager.GetAllPlayerFiles((response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved player files: " + response.items.Length);
}
else
{
Debug.Log("Error retrieving player storage");
}
});
curl -X GET "https://api.lootlocker.io/game/player/files" \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01"
Example response:
{
"items": [
{
"id": 318,
"revision_id": "01GPNZHCVEF6F0QGA3V2B7CN44",
"name": "smol.jpg",
"size": 7056,
"purpose": "SAVE_GAME",
"public": false,
"url": "https://cdn.lootlocker.io/2/892/oJnNPGsiuzytMOJPatwtPilfsfykSBGp.jpg?Expires=1635369933&Signature=Wp-PUZdoh3XdqQNOnPP80-q81ftGpLVJ3oub3RajnfjaP15rHzVWCCJ8e8lzpzrzdilu1gxoTiK1NT7iZayJXV~1XvcagCbkLCsrLkHlDZ0ms17C1YL5iNu1crBCJOhOhpwhknDmgt95NWa2GjLydylj7-0mqjALoURAMzpWvmbXUClUhtzIgGsBIEn2jy~syplWtMstTHE13EHmsxqfbAr8fkp91JGHaLFqSJL5YvlnIe5WoVNeBII8tjBb6YtEEF2dyliLyJOk8RaGtCDodKMmwOlwAlw-~lyfPrUOxH62c87-vkn8~uPQgAxcX0kp6NDudFrO5uiyESyOymIscw__&Key-Pair-Id=APKAIIBA3IODTCVA4BKQ",
"url_expires_at": "2021-10-27T21:25:33.339117882Z",
"created_at": "2021-10-27T14:20:31Z"
}
]
}
Retrieve All Public Files From Another Player
int playerId = 1;
LootLockerSDKManager.GetAllPlayerFiles(playerId, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved player files: " + response.items.Length);
}
else
{
Debug.Log("Error retrieving player storage");
}
});
curl -X GET "https://api.lootlocker.io/game/player/{player_id}/files" \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01"
Example response:
{
"items": [
{
"id": 5318,
"revision_id": "01GPNZHCVEF6F0QGA3V2B7CN44",
"name": "world.jpg",
"size": 7056,
"purpose": "WORLD",
"public": true,
"url": "https://cdn.lootlocker.io/2/892/oJnNPGsiuzytMOJPatwtPilfsfykSBGp.jpg?Expires=1635369933&Signature=Wp-PUZdoh3XdqQNOnPP80-q81ftGpLVJ3oub3RajnfjaP15rHzVWCCJ8e8lzpzrzdilu1gxoTiK1NT7iZayJXV~1XvcagCbkLCsrLkHlDZ0ms17C1YL5iNu1crBCJOhOhpwhknDmgt95NWa2GjLydylj7-0mqjALoURAMzpWvmbXUClUhtzIgGsBIEn2jy~syplWtMstTHE13EHmsxqfbAr8fkp91JGHaLFqSJL5YvlnIe5WoVNeBII8tjBb6YtEEF2dyliLyJOk8RaGtCDodKMmwOlwAlw-~lyfPrUOxH62c87-vkn8~uPQgAxcX0kp6NDudFrO5uiyESyOymIscw__&Key-Pair-Id=APKAIIBA3IODTCVA4BKQ",
"url_expires_at": "2022-06-27T21:25:33.339117882Z",
"created_at": "2022-06-27T14:20:31Z"
}
]
}
Retrieve Single Player File
int playerFileId = 1;
LootLockerSDKManager.GetPlayerFile(playerFileId, (response) =>
{
if (response.success)
{
Debug.Log("Successfully retrieved player file with id: " + response.id);
}
else
{
Debug.Log("Error retrieving player file");
}
});
curl -X GET "https://api.lootlocker.io/game/player/files/{file_id}" \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01"
example response:
{
"id": 318,
"revision_id": "01GPNZHCVEF6F0QGA3V2B7CN44",
"name": "smol.jpg",
"size": 7056,
"purpose": "SAVE_GAME",
"public": false,
"url": "https://cdn.lootlocker.io/2/892/oJnNPGsiuzytMOJPatwtPilfsfykSBGp.jpg?Expires=1635370000&Signature=JKJTvRoZpxgtebwCqtuADp-mH4j958vxo29LvRtWv~VC4iSfQHw5S8YFMVPMiWSJ3s-RY2V5VWBt1njWAjq~4fzDwSVXp6h0a5rPmG0oYa6~BId~sz8Blab2PCPkUMeYkLRG5EsnQyDHwPdHgIVAgZb5fwyVuKldmyQnbqeeHj9DmyoP8AmUsH6OJ63GQw2GkjRhw0x9B3jfn079LdqH0fVX80-UIfv7FRT-gt9fINsBT3ujy5~GoP91mJwPh6EV9xbQmZvAI4j0~5adP4mD01zYum3SARXqPdtax9MWiC42Ad-ADQQje3hsuimaDlhIgELfFhRG1il3FEcNCdw4aA__&Key-Pair-Id=APKAIIBA3IODTCVA4BKQ",
"url_expires_at": "2021-10-27T21:26:40.407880449Z",
"created_at": "2021-10-27T14:20:31Z"
}
Upload a Private Player File From Path
LootLockerSDKManager.UploadPlayerFile("/path/to/file/save_game.zip", "save_game", response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
The Boolean "Is Public" should be set to false in this case, to upload a private file!
curl -X POST "https://api.lootlocker.io/game/player/files" \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01" \
-F 'file=@"path/to/your/file"' \
-F 'purpose="save_game"' \
-F 'is_public="false"'
Example response:
{
"id": 318,
"revision_id": "01GPNZHCVEF6F0QGA3V2B7CN44",
"name": "save_game_1.zip",
"size": 7056,
"purpose": "SAVE_GAME_SLOT_1",
"public": false,
"url": "https://cdn.lootlocker.io/2/892/oJnNPGsiuzytMOJPatwtPilfsfykSBGp.jpg?Expires=1635366031&Signature=Z7MG~WgUyqpBNlXRePXxuV2uFbI0fEkAa3chk-3YO2XlWyd1veSl5V2dmFyVM1CndY6cfHo9ds3ilthwY~NjUiFmrx6ycfG3GJ5Z~kqzuyyMpH~LXTh~tIwnZpJpKScFUeBz5PpkSQPfOo4nuWktQBmpIgOhLlD2cWKOlQllBaIhjFvUh1HGIs-1u2-DiX9eDIgBDYzP4k0aMGH0aKjKF8Wb1jbAwaAcvQBeiPC~B~DgjlsHy6UjS59nYLCI-3EMheivk7H5-z-R65Au8VGg1koP89QtEjViy2HKbMKId~tQ3-cJg-ylRGHbE7jGlRyFC9CQLfeJXqx-IgaKfjVZCQ__&Key-Pair-Id=APKAIIBA3IODTCVA4BKQ",
"url_expires_at": "2021-10-27T20:20:31.433987069Z",
"created_at": "2021-10-27T14:20:31.428496822Z"
}
Upload a Public Player File From Path
// You can also set this to false, if omitted it defaults to false
bool isPublic = true;
LootLockerSDKManager.UploadPlayerFile("/path/to/file/save_game.zip", "save_game", isPublic, response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
The Boolean "Is Public" should be set to true in this case, to upload a public file!
Upload a Private Player File Using FileStream
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
LootLockerSDKManager.UploadPlayerFile(file, "player_file", response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
Upload a Public Player File Using FileStream
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
// You can also set this to false, if omitted it defaults to false
bool isPublic = true;
LootLockerSDKManager.UploadPlayerFile(file, "player_file", isPublic, response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
Upload a Private Player File Using Byte Array
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
var fileBytes = new byte[file.Length];
file.Read(fileBytes, 0, Convert.ToInt32(file.Length));
LootLockerSDKManager.UploadPlayerFile(fileBytes, "filename", "save_game", response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
Upload a Public Player File Using Byte Array
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
var fileBytes = new byte[file.Length];
file.Read(fileBytes, 0, Convert.ToInt32(file.Length));
// You can also set this to false, if omitted it defaults to false
bool isPublic = true;
LootLockerSDKManager.UploadPlayerFile(fileBytes, "filename", "save_game", isPublic, response =>
{
if (response.success)
{
Debug.Log("Successfully uploaded player file, url: " + response.url);
}
else
{
Debug.Log("Error uploading player file");
}
});
Update a Player File from Path
// The ID of the file can be retrieved when creating the file
// or when listing all player files.
int playerFileID = 0;
LootLockerSDKManager.UpdatePlayerFile(playerFileID, "/path/to/file/save_game.zip", response =>
{
if (response.success)
{
Debug.Log("Successfully updated player file, url: " + response.url);
}
else
{
Debug.Log("Error updating player file");
}
});
Be aware that if you update a file, make sure to include everything, even what you don't want to update, as you can update a file to contain nothing.
curl -X PUT 'https://api.lootlocker.io/game/player/files/:file_id' \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01"
-F 'file=@"path/to/your/file"'
Example response:
{
"id": 318,
"revision_id": "01GPNZHCVEF6F0QGA3V2B7CN44",
"name": "save_game_1.zip",
"size": 7056,
"purpose": "SAVE_GAME",
"public": false,
"url": "https://cdn.lootlocker.io/2/892/oJnNPGsiuzytMOJPatwtPilfsfykSBGp.jpg?Expires=1635366031&Signature=Z7MG~WgUyqpBNlXRePXxuV2uFbI0fEkAa3chk-3YO2XlWyd1veSl5V2dmFyVM1CndY6cfHo9ds3ilthwY~NjUiFmrx6ycfG3GJ5Z~kqzuyyMpH~LXTh~tIwnZpJpKScFUeBz5PpkSQPfOo4nuWktQBmpIgOhLlD2cWKOlQllBaIhjFvUh1HGIs-1u2-DiX9eDIgBDYzP4k0aMGH0aKjKF8Wb1jbAwaAcvQBeiPC~B~DgjlsHy6UjS59nYLCI-3EMheivk7H5-z-R65Au8VGg1koP89QtEjViy2HKbMKId~tQ3-cJg-ylRGHbE7jGlRyFC9CQLfeJXqx-IgaKfjVZCQ__&Key-Pair-Id=APKAIIBA3IODTCVA4BKQ",
"url_expires_at": "2021-10-27T20:20:31.433987069Z",
"created_at": "2021-10-27T14:20:31.428496822Z"
}
Update a Player File Using Byte Array
// The ID of the file can be retrieved when creating the file
// or when listing all player files.
int playerFileID = 0;
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
var fileBytes = new byte[file.Length];
file.Read(fileBytes, 0, Convert.ToInt32(file.Length));
LootLockerSDKManager.UpdatePlayerFile(playerFileID, fileBytes, response =>
{
if (response.success)
{
Debug.Log("Successfully updated player file, url: " + response.url);
}
else
{
Debug.Log("Error updating player file");
}
});
Update a Player File Using FileStream
// The ID of the file can be retrieved when creating the file
// or when listing all player files.
int playerFileID = 0;
var file = File.Open("/path/to/file/save_game.zip"", FileMode.Open);
LootLockerSDKManager.UpdatePlayerFile(playerFileID, file, response =>
{
if (response.success)
{
Debug.Log("Successfully updated player file, url: " + response.url);
}
else
{
Debug.Log("Error updating player file");
}
});
Delete Player File
// The ID of the file can be retrieved when creating the file
// or when listing all player files.
int playerFileId = 1;
LootLockerSDKManager.DeletePlayerFile(playerFileId, response =>
{
if (response.success)
{
Debug.Log("Successfully deleted player file with id: " + playerFileId);
}
else
{
Debug.Log("Error deleting player file");
}
});
curl -X DELETE "https://api.lootlocker.io/game/player/files/{file_id}" \
-H "x-session-token: your_token_here" \
-H "LL-Version: 2021-03-01"