Question by
retaliator4894 · May 09, 2017 at 05:20 AM ·
animationscripting problem
How to use an animation with a script?(JS)
HI!(Sorry my english level is probably very bad because i'm french)
I'm trying to use a script(javascript) to call an animation and the console is always saying that :"Object reference not set to an instance of an object".
I think it means that the script don't find the animator, how can I fix it? And is it the correct way to call once the animation?
var culasse : GameObject;
var CulasseMoving : Animator;
function Start(){
CulasseMoving=culasse.GetComponent(Animator);
}
function Shot(){
CulasseMoving.Play("TheBeast1");
}
function Update(){
if(Input.GetButton("Fire1")){
Invoke("Shot",0.1);
}
Comment