Hello,
I’m pretty new to coding and I’m trying to figure out a way to set a condition to trigger a cloned object based on the current playtime of the Animation.
I can get the length of the clip, but how do I read in real time the playtime so I can set the condition as below? obviously the code below fails as its testing the total length on not playtime.
public AnimationClip animPlantShootClip; // I set the animation clip from the inspector
void Update()
{
animShootLength = animPlantShootClip.length;
if (isPlayerInShootRadius)
{
Animator.Play(PLANT_SHOOT);
if (animShootLength == 0.4f)
{
print("Works");
Shoot();
}
}
}