Hi all I have animations with different weapons. so I have transition from "any state" to state "pistol" when variable "weapon" is equals to 4. then I have transition from state "pistol" to state "pistol_idle" when variable "weapon" is equals to 4. And then I have transition from "pistol_idle" to "pistol" when "move" is true. But its not working. when I run game, animation is always on state "pistol". Why is animation not move to state "idle". condition "weapon"=4 is true. Or how I can make switching weapons. Thanks.
From the animator window there, when the game is running, you see the parameter "move" become true? You literally see the check box get checked in play mode when you expect it to?
I'm asking, during gameplay, if you look at that same window, the animator, while the animated object is selected, does that check box get checked by code like it should? Like without you manually checking it... Sorry for asking again, just want to clarify that the code that sets it true is not where the mistake is.
Yes. Its checked by code. And state is always on pistol. But Im write bad transition on first post. its I have transition from state "any state" to "pistol" when variable "weapon" is equals to 4 then I have from "pistol" to "pistol_idle" when variable "side"=4. and then I have transition from "pistol_idle" to "pistol" when move is true
Im fix it. Im add script behavior to state pistol with code: Code (csharp): public class onWeapon : StateMachineBehaviour { // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { animator.SetInteger ("weapon",0); } }