This question was
closed Nov 03, 2016 at 04:24 AM by
FlyingFlambe for the following reason:
The question is answered, right answer was accepted
Question by
FlyingFlambe · Nov 02, 2016 at 10:27 PM ·
animationanimatorplaywrapmode
Cannot apply indexing with [] to an expression of type 'Animator'
Hi, so I'm trying to set up an animation that only loops once before transitioning to another animation, but like the tutorials I read, they use indexing. It doesn't seem like it should be an issue, but I keep getting the error stated via line 3. Any tips on how to remedy this? Thank you!
if (isSpawned && xLastMove.x > 0)
{
anim["SpawnLeft"].wrapMode = WrapMode.Once;
anim.Play("SpawnLeft");
}
Comment
Answer by FlyingFlambe · Nov 03, 2016 at 12:29 AM
Ah, made a mistake. I set anim to the Animator GetComponent when Wrap Mode uses the Animation GetComponent. Thought I'd share this!
If your query is resolved, then accept your comment as answer and close this question.
Sorry, didn't know how that worked til just now. Thanks for the heads up.