How to stop an default animation from playing?

I have a problem, most likely with the Mecanim, or maybe there is an easy code trick. Anyway, I have this animator setup:


With the scene start, my object is in the default “New State” state, when I cast a raycast to it, I have a function which turns on a trigger that starts playing “Wall_1” animation. Then I have the “Wall_1_Stop” animation which is just a copy of a last frame of “Wall_1”, so it doesn’t loop after it is played once. But the thing is that after “Wall_1” finishes playing, it goes to “Wall_1_Stop” and then to the “New State” again, even though I have only one way connections between all of the states. I tried turning off looping in the animation settings, but it didn’t change anything. So, how do I prevent it from going back to the default state?

Here is my simple code that is attached to that object:

void ShrinkFunction (bool shrink)
		if (shrink = true) {



By the way, what I’m trying to do is when I click on the object, an animation plays only once, which shrinks it down to 1,1,1 cube so it stays this way.

Please help me out here. Thanks you very much in advance!

Remove the connection between Any State and New State. Also as a suggestion, you could change your Wall_1 animation to not loop and then you wouldn’t need the stop step.