diff --git a/Assets/VRM10/Runtime/IO/Vrm10.cs b/Assets/VRM10/Runtime/IO/Vrm10.cs index daf3b51c6..c28e25e0b 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10.cs @@ -44,6 +44,11 @@ namespace UniVRM10 VrmMetaInformationCallback vrmMetaInformationCallback = null, CancellationToken ct = default) { + if (awaitCaller == null) + { + awaitCaller = new ImmediateCaller(); + } + return await LoadAsync( path, System.IO.File.ReadAllBytes(path), @@ -81,6 +86,11 @@ namespace UniVRM10 VrmMetaInformationCallback vrmMetaInformationCallback = null, CancellationToken ct = default) { + if (awaitCaller == null) + { + awaitCaller = new ImmediateCaller(); + } + return await LoadAsync( string.Empty, bytes, @@ -105,7 +115,6 @@ namespace UniVRM10 CancellationToken ct) { ct.ThrowIfCancellationRequested(); - if (awaitCaller == null) { throw new ArgumentNullException(); @@ -172,6 +181,10 @@ namespace UniVRM10 CancellationToken ct) { ct.ThrowIfCancellationRequested(); + if (awaitCaller == null) + { + throw new ArgumentNullException(); + } var vrm10Data = await awaitCaller.Run(() => Vrm10Data.Parse(gltfData)); ct.ThrowIfCancellationRequested(); @@ -203,6 +216,10 @@ namespace UniVRM10 CancellationToken ct) { ct.ThrowIfCancellationRequested(); + if (awaitCaller == null) + { + throw new ArgumentNullException(); + } Vrm10Data migratedVrm10Data = default; MigrationData migrationData = default; @@ -243,6 +260,10 @@ namespace UniVRM10 CancellationToken ct) { ct.ThrowIfCancellationRequested(); + if (awaitCaller == null) + { + throw new ArgumentNullException(); + } if (vrm10Data == null) { diff --git a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10RuntimeLoader.cs b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10RuntimeLoader.cs index bcd5fd278..3a0feb381 100644 --- a/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10RuntimeLoader.cs +++ b/Assets/VRM10_Samples/VRM10FirstPersonSample/VRM10RuntimeLoader.cs @@ -86,7 +86,7 @@ namespace UniVRM10.FirstPersonSample async Task LoadAsync(string path, VRMShaders.IAwaitCaller awaitCaller) { - var instance = await Vrm10.LoadPathAsync(path); + var instance = await Vrm10.LoadPathAsync(path, awaitCaller: awaitCaller); // VR用 FirstPerson 設定 await instance.Vrm.FirstPerson.SetupAsync(instance.gameObject, awaitCaller);