com.unity.cloud.ktxが存在していない場合にそのままnullを返す実装に切り替わりますが、そのままだとasyncメソッドで一度もawaitしていないので次のようなコンパイラの警告が出てしまっていました。
```
Assets/VRMShaders/GLTF/IO/Runtime/Texture/Importer/KtxTextureDeserializer.cs(14,38): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
```
pragmaを用いて警告を抑制するようにしました。
This is a breaking change since it introduces new interface method to IAwaitCaller.
----
NextFrameIfTimedOut() is added to IAwaitCaller. The following inheritors also introduce the method.
- ImmediateCaller.NextFrameIfTimedOut() just invokes NextFrame().
- RuntimeOnlyAwaitCaller.NextFrameIfTimedOut() invokes NextFrame() if timed out. Otherwise, do nothing.
- RuntimeOnlyNoThreadAwaitCaller.NextFrameIfTimedOut() works same as RuntimeOnlyAwaitCaller.
Constructor of RuntimeOnlyAwaitCaller and RuntimeOnlyNoThreadAwaitCaller
now take argument of timeout in seconds. The default value is 1/1000 (1 milliseconds).
See also:
https://github.com/vrm-c/UniVRM/pull/1781#pullrequestreview-1100131840
This change adds (pseudo) method RuntimeOnlyAwaitCaller.NextFrameIfTimedOut()
which invokes NextFrame() if given time is elapsed. Otherwise, it does nothing.
We'll be able to utilize this (pseudo) method to ease possible cause of spikes.
For example:
----
public class VRMImporterContext : ImporterContext {
protected override async Task OnLoadHierarchy(IAwaitCaller awaitCaller, ...) {
...
var blendShapeList = VRM.blendShapeMaster.blendShapeGroups;
if (blendShapeList != null && blendShapeList.Count > 0) {
foreach (var x in blendShapeList) {
await awaitCaller.NextFrameIfTimeout();
BlendShapeAvatar.Clips.Add(await LoadBlendShapeBind(awaitCaller, x, transformMeshTable));
}
}
...
}
}
----
Note that this change doesn't add NextFrameIfTimeout() to IAwaitCaller to avoid
breaking change. This limitation introduces extra (maybe unnecessarily) complexity.