diff --git a/Scripts/Format/VRMImporter.cs b/Scripts/Format/VRMImporter.cs index 5ba2f2abb..9b8230f48 100644 --- a/Scripts/Format/VRMImporter.cs +++ b/Scripts/Format/VRMImporter.cs @@ -183,7 +183,7 @@ namespace VRM } LoadBlendShapeMaster(context); - VRMSpringUtility.LoadSecondary(context.Root.transform, context.Nodes, + VRMSpringUtility.LoadSecondary(context.Root.transform, context.Nodes, context.VRM.extensions.VRM.secondaryAnimation); LoadFirstPerson(context); @@ -407,7 +407,7 @@ namespace VRM #region LoadVrmAsync static IEnumerator LoadTextures(VRMImporterContext context, IStorage storage) { - for(int i=0; i onLoaded) + public static void LoadVrmAsync(string path, Action onLoaded, Action onError = null) { var context = new VRMImporterContext(path); context.ParseVrm(File.ReadAllBytes(path)); - LoadVrmAsync(context, onLoaded); + LoadVrmAsync(context, onLoaded, onError); } - public static void LoadVrmAsync(Byte[] bytes, Action onLoaded) + public static void LoadVrmAsync(Byte[] bytes, Action onLoaded, Action onError = null) { var context = new VRMImporterContext(); context.ParseVrm(bytes); - LoadVrmAsync(context, onLoaded); + LoadVrmAsync(context, onLoaded, onError); } - public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded) - { - LoadVrmAsync(ctx, onLoaded, Debug.LogError); - } - - public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError) + public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError = null) { + if (onError == null) + { + onError = Debug.LogError; + } LoadVrmAsyncInternal(ctx) .Subscribe(Scheduler.MainThread, onLoaded, onError); }