I’m trying to disable the Animation component of a character in a function that also enables its ragdoll. Here’s the script:
public Component selfAnim;
void Start(){
selfAnim = gameObject.GetComponent<Animation>();
}
void Die(){
selfAnim.enabled = false;
}
But I get this error
Type UnityEngine.Component' does not contain a definition for
enabled’ and no extension method enabled' of type
UnityEngine.Component’ could be found (are you missing a using directive or an assembly reference?)
Is this not the right way to disable the Animation component?