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] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E6=97=A5?= =?UTF-8?q?=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(); } }