# Mecanim opposite transitions. Easy made hard?

I’ll have to admit, I just started using Mecanim, went through a couple of tutorials, tried to use it my scene.

I have an “idle” state and 5 movements on each side (a total of 11 clips). I’ve set my Animator controller, and I’m working on my transitions. I tried for testing purposes to have simple conditions, so I set an integer variable to control which state will play at a specific time. When this variable equals to 0 it will play my idle clip. And I want to be able to go back and forth between my states. Basically it’s a series of integers:
-5,-4,-3,-2,-1,0,1,2,3,4,5.
When my variable is 0 it plays my idle clip, and I change my variable with a script, so I would like to play my transitions and move the clip besides it, but both ways. So I created transitions from every clip to the previous and to the next one, and the other way around.

I must be doing something wrong there. For example when going from 0 to -1 I set both transitions “when var equals to -1”. But naturally when setting my variable to -1 it kept looping between clip"0" and clip"-1", which is not what I want.

So I changed my variable to float and going from 0 to -1 I set the condition “when var is less than -0.5” while going from -1 to 0 I set the condition to “when var is greater than -0.5” and followed that pattern for the rest of the transitions. So going from -1 to -2 I’ve set “less than -1.5” and “greater than -1.5” etc and on the other side going from 0 to 1 I used “greater than 0.5” and “less than 0.5”, “greater than 1.5” and “less than 1.5” and so on. I hope that’s clear enough.

And now comes the strange part (at least for me)…

I can go from 0 to -1 and back nicely. If I go from -1 to -2, the opposite transition doesn’t work. I can go to -3 but not back to -2… Also I can’t go from 0 to 1, 2 etc…
It seems like I can only go one way and I can’t even go back, except for my first transition to the left…

What am I doing wrong?

**** Whenever I say “I go from 0 to -1” or something like that, I’m referring to the corresponding animation clips. I don’t have any problem with changing my variable value. ****

It seems like the second way I had in mind (using float as the variable type) and checking whether its value is greater or less than the half of the 2 states works…

I changed 2 things at once, so I’m not sure exactly which of them was causing the conflict. First, I got a “index m_intcount” message, with some googling I found that it had to do with the fact that I changed the variable type from int to float without redoing all my transitions. So I deleted them and recreated them…

The second thing, had to do with the script I used to change my variable value, I was using the same controls (left and right arrow keys) with another script I used for a different gameobject, maybe some conflict there…