I read in a Unity blog post that using normal animation with UI in Unity is not really recommended, but instead you should use tweening if you can. To test this so I tried the same animation with both methods. I'm not really expert in tweening but this was really simple animation so I thought it should be ok. Basically I'm filling a image from 0 to 1 with looping animation. When I compared these two methods of animation in the profiler I noticed that while tweening, I get spikes of about 20ms for the time the tween is active, which is similar to normal animation. I'm not sure if this is normal behavior for UI or I am doing something wrong. This is my tween code:
Tween tween;
private void OnEnable()
{
tween = image.DOFillAmount(1, 1f).From(0).SetAutoKill(false);
tween.OnComplete(() => tween.Restart());
}
private void OnDisable()
{
tween.OnComplete(null);
tween.SetAutoKill(true);
}
I also tried something like this which does the same thing:
private void OnEnable()
{
tween = image.DOFillAmount(1, 1f).From(0).SetLoops(-1, LoopType.Restart);
}
private void OnDisable()
{
tween.Kill();
}

