From c3f7e8949e554c69c19db3a8f6045ca3ba742ee9 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Mon, 30 Dec 2024 20:55:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3webgl=E9=9F=B3=E9=A2=91?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResKit/Scripts/LocalAudioSupport.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs b/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs index bd027002..025d12cc 100644 --- a/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs +++ b/Assets/QFramework/Toolkits/ResKit/Scripts/LocalAudioSupport.cs @@ -3,6 +3,7 @@ namespace QFramework using UnityEngine; using System.Collections; using UnityEngine.Networking; + using UnityEngine.Rendering; public static class LocalAudioResUtil { @@ -192,9 +193,30 @@ namespace QFramework } else { - // Convert the downloaded data to an AudioClip + // ȴ + while (!request.downloadHandler.isDone) + { + yield return null; + } + + + // ɺתΪ AudioClip AudioClip clip = DownloadHandlerAudioClip.GetContent(request); - mAsset = clip; + + if (clip != null) + { + // Ƶ״̬ + while (clip.loadState != AudioDataLoadState.Loaded) + { + yield return null; + } + + mAsset = clip; // Ƶɺֵ mAsset + } + else + { + Debug.LogError("Failed to load audio clip."); + } } if (RefCount <= 0) From bb57c527b76903532cca14501f044992c592d39e Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Tue, 31 Dec 2024 13:16:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Actions/AnimationAction.cs | 43 ++++++++++++++--------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/Actions/AnimationAction.cs b/Assets/Scripts/Actions/AnimationAction.cs index f2cc26a3..5a9691af 100644 --- a/Assets/Scripts/Actions/AnimationAction.cs +++ b/Assets/Scripts/Actions/AnimationAction.cs @@ -46,30 +46,39 @@ namespace QFramework GameObject obj = Utility.FindObj(path); if (obj != null) { - anim = obj.GetComponent(); + try + { + anim = obj.GetComponent(); - if (string.IsNullOrEmpty(frame) == false && frame != "-1") - { - int curFrame = 0; - int.TryParse(frame, out curFrame); - anim[animName].time = curFrame / anim.clip.frameRate; - anim[animName].speed = 0; - anim.Play(animName); - this.Finish(); - } - else - { - float curSpeed = 1; - if (string.IsNullOrEmpty(speed)==false) + if (string.IsNullOrEmpty(frame) == false && frame != "-1") { - float.TryParse(speed, out curSpeed); + int curFrame = 0; + int.TryParse(frame, out curFrame); + anim[animName].time = curFrame / anim.clip.frameRate; + anim[animName].speed = 0; + anim.Play(animName); + this.Finish(); + } + else + { + float curSpeed = 1; + if (string.IsNullOrEmpty(speed) == false) + { + float.TryParse(speed, out curSpeed); + } + anim[animName].speed = curSpeed; + anim.Play(animName); } - anim[animName].speed = curSpeed; - anim.Play(animName); } + catch (Exception) + { + Debug.LogError($"{path} Ŷ {animName} "); + } + } else { + Debug.LogError("δҵ·" + path); this.Finish(); } }