Fix to DownloadMeshData calling the Finished event before the _meshDatasInProgress was set to false.

This commit is contained in:
Filip Franik
2023-01-31 23:44:33 +01:00
parent 87549a3e6c
commit 836f72481b

View File

@@ -101,13 +101,15 @@ namespace FlaxEngine.Utilities
private void DownloadMeshData() private void DownloadMeshData()
{ {
var success = false;
try try
{ {
if (!_model) if (!_model)
{ {
_meshDatasInProgress = false;
return; return;
} }
var lods = _model.LODs; var lods = _model.LODs;
_meshDatas = new MeshData[lods.Length][]; _meshDatas = new MeshData[lods.Length][];
@@ -127,8 +129,7 @@ namespace FlaxEngine.Utilities
}; };
} }
} }
success = true;
Finished?.Invoke();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -139,6 +140,11 @@ namespace FlaxEngine.Utilities
finally finally
{ {
_meshDatasInProgress = false; _meshDatasInProgress = false;
if (success)
{
Finished?.Invoke();
}
} }
} }
} }