Hi,
I’m new to programming. Was just wondering if anyone would know how to have a biped with an animation “punch” play every 2 seconds.
Hi,
I’m new to programming. Was just wondering if anyone would know how to have a biped with an animation “punch” play every 2 seconds.
private float lastPlay; //last time animation was played
void Update () {
if(Time.time - lastPlay >= 2) { //if its been 2 or more seconds since last play
lastPlay = Time.time; //reset last play time to current time
animation["punch"].Play(); //play "punch" animation
}
}
Thanks man!