Hi, I’m new to Unity and haven’t been able to find anything online related to this issue.
I’m trying to get my sword to swing with a basic animation made in unity when I click the left mouse button, but for some reason the animation plays as it should, but only once when I enter the game view and it isn’t called when I click the left mouse button as it should.
Here is what i’m working with with the code to the right. (The error at the bottom should be solved already)
l
From what I can see, your Sword variable is a Transform object.
The animation will reside on the game object itself. Try using:
Sword.parent.animation.Play("MeleeAttack");