- Home /
Set Menu active after animation
i have a menu in my game that it's active state is set to false. at the end of the animation i want to set the menu to true so that the player can make a choice. I've tried using instantiate and find object but it the end the nothing happens and the animation just loops
see code
public class AfterStart : StateMachineBehaviour { private GameObject WeaponSelect;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
WeaponSelect = GameObject.Find("Weapon Select");
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
}
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
WeaponSelect.SetActive(true);
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
//
//}
}
Comment
Your answer
Follow this Question
Related Questions
How to create a login system online? 1 Answer
Basic Scripting help 2 Answers
character creation 2 Answers