fix(editor): 修复 AnimationClip 复用时 StopTime 未更新
Made-with: Cursor
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user