Hello, i'm having a random problem with animations that uses path (at least when i remove the path the problem disappears)
I created a script to randomize the TimeScale, TrackTime and Skin at the start of the scene.
When animations don't have a path, it workds perect, but when i add it, randomly when i put some copies of the same GameObject, some of them are in pause with no reason.
There isn't an error message, just it happens.
I put here the code, if someone knows why some animations randomly are paused in execution when the animation has a path, i would be really greatful.
If need more info just ask for it.
[Header("Time Scale")]
public bool randomTimeScale = true;
[Range(0.5f, 1f)]
public float minTimeScale = 0.8f;
[Range(1f, 1.5f)]
public float maxTimeScale = 1.2f;
[Space(10)]
[Header("Start Time")]
public bool randomStart = true;
private float minStartTime = 0f;
[Range(0f, 1f)]
public float maxStartTime = 1f;
[Space(10)]
[Header("Animation")]
[SpineAnimation]
public string idle;
public SkeletonAnimation skeletonAnimation;
private Spine.AnimationState spineAnimationState;
[Space(10)]
[Header("Skin")]
public bool randomSkin = true;
public ExposedList<Skin> skins;
public Skin[] skinArray;
// Start is called before the first frame update
void Start()
{
skins = skeletonAnimation.skeleton.Data.Skins;
skinArray = new Skin[skins.Count];
skins.CopyTo(skinArray);
spineAnimationState = skeletonAnimation.AnimationState;
TrackEntry track = spineAnimationState.SetAnimation(0, idle, true);
if (randomTimeScale)
track.TimeScale = Random.Range(minTimeScale, maxTimeScale);
if (randomStart)
track.TrackTime = Random.Range(minStartTime, maxStartTime);
if (randomSkin)
skeletonAnimation.Skeleton.SetSkin(skinArray[Random.Range(0, skinArray.Length)].Name);
}