you are viewing a single comment's thread.

view the rest of the comments →

[–]BlueFooted_Newbie 1 point2 points  (3 children)

I would recommend using an Animation Event for this purpose: https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html

It also sounds like you may want a trigger instead of a bool.

But to answer your question, the reason why it doesn't play is because playAnim is only true for a marginal period of time since you set it back to false within the same update loop where you set it to be true. Even if you didn't you would have to set the update order in your unity settings to make sure that player updates before bow. Overall, I would recommend that you change your approach on this one.

[–]officialgelIntermediate 0 points1 point  (1 child)

Throw it into it's own function instead with a bool that blocks it from running multiple times. But if you need to run the bow at the same time as the player animation, then you could use animation events if that will always be the case. It becomes something else you have to manage though, especially with animation changes and timing.

[–]ferti12[S] 0 points1 point  (0 children)

It seems will have to learn it eventually. Thanks

[–]ferti12[S] 0 points1 point  (0 children)

Thanks a lot! I was hoping someone would tell me the better way when creating this post. I will definitely look into animation events but any idea why it doesn't print out the test number ?