AnimationClipSettings.stopTime not taking into effect unless Unity is restarted.

Version: 2018.4.26f1

var animationClipSettings = AnimationUtility.GetAnimationClipSettings(animationClip);
animationClipSettings.startTime = 0.0f;
animationClipSettings.stopTime = _stopFrameCount / animationClip.frameRate;
AnimationUtility.SetAnimationClipSettings(animationClip, animationClipSettings);
EditorUtility.SetDirty(animationClip);
AssetDatabase.CreateAsset(animationClip, path);
AssetDatabase.SaveAssets();
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);

If I open the animation file in my editor, I can see m_stopTimeset correctly. However, in the inspector window, it’s still the old value. If I restart Unity, it works.

If the value is say, 0.0333335, I just change it to 0.033334 in my text editor (so Unity sees the change), and I can see the changes.

I’ve seen the something similar when marking animations as looping/not, except that it actually shows the correct value in the Inspector but then ignores the change in Play Mode until Unity is restarted.

Did you report a bug?

1 Like

I’ve seen those posts, I believe. I’ll do that now.