Common stutters from PrimeTween I am not sure what is causing this behaviour? #51
-
I am proffiling my build and lets say roughly once every 5 to 10 seconds this spike happens. Context: Here is the code that uses this:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Hmm, I can't reproduce this issue on my side in a stress test even with 1000 punches starting at the same time. Can you please provide more info that may help in debugging the issue? |
Beta Was this translation helpful? Give feedback.
-
@NGrigorov Thanks for the additional info! Do you experience the same stutters without the Profiler? Profiler impacts performance by A LOT, especially with deep call stacks. And because two completely different call stacks show a similar stutter, I believe you're observing a Profiler's impact.
The objects are destroyed when a scene is unloaded or changed. Can you please check if this is the case? Please also show the first error, typically it's the one that's the most relevant. I would also appreciate a small reproducible example to isolate the issue from other dependencies. For example, this is a stress test I wrote trying to reproduce the issue, but with no luck. Tried it both on Android and macOS builds: PrimeTweenExample.cs (click to expand)using PrimeTween;
using UnityEngine;
public class PrimeTweenExample : MonoBehaviour {
[SerializeField] ShakeSettings shakeSettings = new ShakeSettings(new Vector3(0, 0.25f));
[SerializeField] int count = 1000;
Transform[] transforms;
Tween[] tweens;
void Awake() {
transforms = new Transform[count];
tweens = new Tween[count];
for (int i = 0; i < count; i++) {
transforms[i] = new GameObject().transform;
}
}
void Update() {
for (int i = 0; i < transforms.Length; i++) {
if (!tweens[i].isAlive) {
tweens[i] = Tween.PunchLocalPosition(transforms[i], shakeSettings);
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
To be honest I can't tell without the profiller :/. The stutter only happens for a single frame out of my target 60 and as of right now I can't tell, maybe once I get more stuff going on around it would be easier. But I am inclined to agree with you that its probably a deep profiller issue thats causing this.
I am 100% sure that this is why. My logger didn't show anything until I switched scenes, which means, while there were dmgPopups doing the OnComplete i switched scenes and the object got destroyed.
I'll try to make one later today that matches my setup but only the dmg popUps. Thank you for the quick responces! @KyryloKuzyk |
Beta Was this translation helpful? Give feedback.
@NGrigorov Nope, still nothing. Maybe I use the latest version of Unity 2021.3.34f instead of yours 2021.3.23f. But maybe this issue doesn't exist on M1 chip.
In any case, Profiler is an approximate tool designed to look for bottlenecks and give an approximate picture. But it's not the perfect tool to measure actual real-world performance. This is why I use Performance testing API in my tests.