- Home /
Question by
LeftyTwoGuns · Sep 03, 2014 at 03:16 AM ·
c#animationgetcomponent
How to disable Animation component?
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?
Comment
Best Answer
Answer by kacyesp · Sep 03, 2014 at 03:18 AM
Change
public Component selfAnim;
To
public Animation selfAnim;
Your answer
Follow this Question
Related Questions
Why isn't the animator getting my values? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers