Hello there, welcome
Please read this page for how you can post code that shows up nicely on the forums: Using code tags properly
I think this solution might work for you…
void Start() {
StartCoroutine(IdleChanger());
}
IEnumerator IdleChanger() {
// cached wait for seconds variable for subsequent use.
WaitForSeconds wfs = new WaitForSeconds(3);
while (true) {
yield return wfs;
// random integer range of 0, 10 gives 0 -> 9
anim.SetInteger("RandomIdle", Random.Range(0, 10));
}
}
This will randomly change the animation (assuming your animator is setup correctly) every 3 seconds. Or at least pass a different random value every 3 seconds, and you have your different idles… however that is
Please delete the StartCoroutine from Update lol That will make a new coroutine every frame. You do not want that.
If Update() is empty after you delete that, delete the entire update method from the code, too
Hope that helps.