I’ve been trying everything I can think of while failing miserably for a couple hours now to get line 26 “animator.SetBool(“hasLight”, true);” to fire after .86 seconds, and I’m failing hard. Any pointers? EventTime is set to .46 and is working great. I’ve tried using the same type of timer triggers in OnStateExit and within Update but hasLight never changes to true.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DR;
public class WaitToExitState : StateMachineBehaviour
{
public float EventTime;
private bool _eventTriggered;
// 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)
{
_eventTriggered = false;
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if (stateInfo.normalizedTime >= EventTime && !_eventTriggered)
{
_eventTriggered = true;
animator.GetComponentInParent<CombatHandlerV2>().MakeTorch();
//
animator.SetBool("hasLight", true); //how can I time this so it becomes true after .86 seconds? (I'd settle for one second)
//
}
}
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
//{
//
//}
}