Scene setup:
Code attached to collider script:
public GameObject weaponObject;
void OnMouseDown(){
Debug.Log(weaponObject);
weaponObject.animation.Play();
}
I honestly don’t know where I am going wrong, every time I click it says “Default clip could not be found in attached animations list”. If I change the code to animation.Play(“swing”); it errors and says the animation could not be found. Please NOTE that the animation itself is applied to the child mesh (pCube1) inside the swordMain prefab.
Driving my crazy, I have tried everything I can think of. Another weird glitch is that the animation always plays once when I start the game, despite play automatically and loop being turned off.
Thanks in advance