// OnStateExit is called when a transition ends and the state machine finishes evaluating this state public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { foreach (string objName in ObjectsToChangeState) { GameObject obj = AnimatorStatesHelper.GetObjectWithName(objName); obj.SetActive(DisableOnBeginningInstead); } if (AlsoDisableOccluder) { Occluder.SetActive(true); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (ObjectsToChangeState.Count == 0) { Debug.LogWarning($"Object list for {animator.GetNextAnimatorClipInfo(layerIndex)[0].clip.name} is empty."); } foreach (string objName in ObjectsToChangeState) { GameObject obj = AnimatorStatesHelper.GetObjectWithName(objName); obj.SetActive(!DisableOnBeginningInstead); } if (!Occluder) { Occluder = AnimatorStatesHelper.GetOccluder(); } if (AlsoDisableOccluder) { Occluder.SetActive(false); } }