- Home /
Animation cannot be disabled.
I would very pleased to get assistance on what I'm doing wrong here:
#pragma strict
var HUDDIS : Transform;
var NOPASSIS : Transform;
var CAMMIS : Transform;
var CAMMIMATION : Transform;
function Start () {
}
function Update () {
if(Input.GetKeyDown(KeyCode.E))
UpdatePETS();
}
function UpdatePETS () {
if(HUDDIS.active){
NOPASSIS.active = false;
HUDDIS.active = false;
CAMMIS.GetComponent(CameraSwitcher).enabled = false;
CAMMIMATION.GetComponent(Animation).enabled = false;
} else {
HUDDIS.active = true;
NOPASSIS.active = true;
CAMMIS.GetComponent(CameraSwitcher).enabled = true;
CAMMIMATION.GetComponent(Animation).enabled = true;
Destroy (this);
}
}
The animaton component "(Animation)" refuses to be disabled when I'm pressing "E". What am I doing wrong? It is a stock animation component btw, does it therefore have an entirely different definition?
Comment
Answer by golemsmk · Nov 07, 2013 at 09:39 AM
Is "Animation" is your own script? If so, then change its name into "StartAnimation" or something like that, and then you do this:
var cammiAnimation = CAMMIMATION.GetComponent(Animation); cammiAnimation.enable = true;
I think that will be fine.
I said that it is the stock animation component that unity has. How can I disable that?
Your answer