I am trying to upload Entity Objects and Files at the same time but keep encountering an EntityProfileVersionMismatch error. Here is a truncated version of the code that I am using:
static readonly EntityKey Key = new EntityKey() {
Id = "-------",
Type = "title_player_account"
};
static void TestFunc() {
SetObjectsRequest objectsRequest = new SetObjectsRequest() {
Objects = new List<SetObject>() {
new SetObject() {
ObjectName = "object_4",
DataObject = "test"
}
},
Entity = Key,
ExpectedProfileVersion = null
};
InitiateFileUploadsRequest filesRequest = new InitiateFileUploadsRequest() {
FileNames = new List<string>() {"file_1"},
Entity = Key,
ProfileVersion = null
};
PlayFabDataAPI.SetObjects(objectsRequest, _ => Debug.Log("SetObjectsSuccess"), error => Debug.LogError($"SetObjectsError: {error.GenerateErrorReport()}"));
PlayFabDataAPI.InitiateFileUploads(filesRequest, OnInitiateFile, error => Debug.LogError($"InitiateFileError: {error.GenerateErrorReport()}"));
}
static void OnInitiateFile(InitiateFileUploadsResponse response) {
Debug.Log("OnInitiateFile: Success");
AbortFileUploadsRequest abortRequest = new AbortFileUploadsRequest() {
FileNames = new List<string>() {"file_1"},
Entity = Key,
};
PlayFabDataAPI.AbortFileUploads(abortRequest, _ => Debug.Log("Abort success"), _ => Debug.Log("Abort failure"));
}
When I set the ProfileVersions of both requests to null or 0, then the error I get is "EntityProfileVersionMismatch". The function that returns this error depends on which function "reaches" the server first. When I try setting the ProfileVersions of both requests to an arbitrary number greater than zero, then the error I get is "SetObjectsError: /Object/SetObjects: The version 1 did not match the profile version of 907". (This is expected behavior but was curious what the expected version was).