Hey @Ihabbalakho I would love to help! Okay so the issue with what you are doing is that you are attempting to directly modify the component. Unity doesn’t like this and requires you to make a reference of the component first as a variable, and then play the animation from that variable.
Example:
var gameObjectAnim = GameObject.Find("Object").GetComponent<Animation>(); gameObjectAnim.Play("AnimationName");
I hope this helped! If you have any other questions I would be glad to help!