mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-26 13:12:35 -05:00
fix cancel handling
This commit is contained in:
parent
a6945d79f9
commit
a22b4b6f52
|
|
@ -157,14 +157,7 @@ namespace UniVRM10
|
|||
{
|
||||
if (ct.IsCancellationRequested && result != null)
|
||||
{
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
UnityEngine.Object.Destroy(result.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(result.gameObject);
|
||||
}
|
||||
UnityObjectDestoyer.DestroyRuntimeOrEditor(result.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -202,9 +195,8 @@ namespace UniVRM10
|
|||
|
||||
// 2. Load
|
||||
var gltfInstance = await loader.LoadAsync(awaitCaller);
|
||||
if (ct.IsCancellationRequested)
|
||||
if (gltfInstance == null)
|
||||
{
|
||||
gltfInstance.Dispose();
|
||||
return default;
|
||||
}
|
||||
|
||||
|
|
@ -215,6 +207,13 @@ namespace UniVRM10
|
|||
return default;
|
||||
}
|
||||
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
// NOTE: Destroy before showing meshes if cancelled.
|
||||
gltfInstance.Dispose();
|
||||
return default;
|
||||
}
|
||||
|
||||
if (showMeshes)
|
||||
{
|
||||
gltfInstance.ShowMeshes();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user