Once the submenu has dropped down and the gameobject is from true to false and back to true the state machine doesn't work as it initially did.
Develop drop down lists
1 hour ago, davejones said:Once the submenu has dropped down and the gameobject is from true to false and back to true the state machine doesn't work as it initially did.
I animated the values, maybe changing something removed the animation?
I like using the animation for this kind of thing, because then I don't need to check when the animation is done. Instead the animation changes the values right before it stops playing. Moving from the Animation to a "idle" animation; also means the values don't reset when the animation is done.
Just check the original to see how it worked. If you still can't solve it I will try to help; unfortunately I am a little pressed for time at the moment.
I have tried numerous things but still can't seem to solve the issue. I have listed below in points what the issue is.
public int State { get; private set; }
public void BtnDropDown()
{
State = 1 - State;
m_aniPlayer.SetInteger("MenuState", State);
}
void Start()
{
State = 0;
m_aniPlayer = this.GetComponent<Animator>();
}
The animation state machine has an int for the state but so too does the class. I am looking at how to keep the animator on the current state rather than resetting to idle on being re enabled.
Psuedocode
onEnable
menu state = current state
OnDisable
menu state = current state
I suppose its just a case of finding out how to do this because I believe the issue is that the animation state machine resets on disabling/ re enabling of the GameObject.
On 8/16/2018 at 12:53 PM, davejones said:The animation state machine has an int for the state but so too does the class.
It is recommended to use the Unity animation state for this. Or you could just check that the animation state is always equal to the class state.
Basically the Unity animations uses states as triggers, it is always checking the states to see if it can move to the next state. Also checking the animation state instead of the class state should have a very similar cost; because it is only a pointer.
In other words, you could just use the Unity animation states; no reason not to.
12 hours ago, Scouting Ninja said:It is recommended to use the Unity animation state for this. Or you could just check that the animation state is always equal to the class state.
Basically the Unity animations uses states as triggers, it is always checking the states to see if it can move to the next state. Also checking the animation state instead of the class state should have a very similar cost; because it is only a pointer.
In other words, you could just use the Unity animation states; no reason not to.
So is it a case of just using the animation states parameters such as the trigger parameter and controlling the parameter though a class?
2 hours ago, davejones said:So is it a case of just using the animation states parameters such as the trigger parameter and controlling the parameter though a class?
I think you might of hit the nail on the hesd.