Using cycle offset feature inside of animator?

Theirs an “OffsetAnimation” parameter inside the animator that you can assign to animation states.

I’m unsure how to effect that number to use it to offset a character’s idle or the like should I want to spawn several at the same time. (the goal to have them all play their animation with an offset so they don’t all look the synched up with each other.

Has anyone used this?

Thanks!

You can use parameter for modifying Cycleoffset value. Make a “float” parameter. (Cycleoffset’s valid range is [0.0 - 1.0].)
Then assign the parameter from Inspector screen.

And from code, set your parameter:

GetComponent<Animator>().SetFloat("Offset", Random.Range(0.0f, 1.0f));

113295-1.jpg

I need this a lot in crowd animations etc. and generally use something like:

anim = GetComponent<Animator>();

		randomIdleStart = Random.Range(0,anim.GetCurrentAnimatorStateInfo(0).length); //Set a random part of the animation to start from
		anim.Play("Crow|Idle", 0, randomIdleStart);

Where you get the length of the animation, then randomly start at any point of it.