From 603a36f5752e6ac847bea183ef8ae13f4eae60e3 Mon Sep 17 00:00:00 2001 From: Ding Yuntian <1491671119@qq.com> Date: Thu, 16 Apr 2026 00:14:53 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFfix(editor):=20=E4=BF=AE=E5=A4=8D=20An?= =?UTF-8?q?imationClip=20=E5=A4=8D=E7=94=A8=E6=97=B6=20StopTime=20?= =?UTF-8?q?=E6=9C=AA=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- Assets/Editor/Window/AnimationClipGeneratorCore.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/Editor/Window/AnimationClipGeneratorCore.cs b/Assets/Editor/Window/AnimationClipGeneratorCore.cs index d566e85d1..9776a6e26 100644 --- a/Assets/Editor/Window/AnimationClipGeneratorCore.cs +++ b/Assets/Editor/Window/AnimationClipGeneratorCore.cs @@ -533,6 +533,16 @@ namespace AibisDream.SystemEditor settings.loopTime = animationData.loop; AnimationUtility.SetAnimationClipSettings(clip, settings); + // 强制更新动画长度 (m_StopTime) - 修复复用已有 clip 时长度未更新的问题 + float totalDuration = keyframes.Count > 0 ? keyframes[keyframes.Count - 1].time : 0f; + SerializedObject serializedClip = new SerializedObject(clip); + SerializedProperty stopTimeProp = serializedClip.FindProperty("m_StopTime"); + if (stopTimeProp != null) + { + stopTimeProp.floatValue = totalDuration; + serializedClip.ApplyModifiedProperties(); + } + // 保存 / 更新 AnimationClip 资源 if (isNewClip) {