Question by
mattlewis83 · Jan 20, 2016 at 01:38 AM ·
animationscripting problemanimatorscripting beginner
Animation only plays once
As an artist i cannot for the life of me understand how the new animator works... I was privy to the legacy system. Anywho, i am trying to code a simple springboard and for some reason my script only plays the animation once and then never again. Obviously it would need to trigger the animation every time the on trigger enter function is called. Here is the current script i'm using. Any help would be greatly appreciated! Btw, for those even worse off than me... this is written in JavaScript. Thanks!
#pragma strict
var ani : Animator;
var sound : AudioClip;
function Start () {
ani.enabled = false;
}
function OnTriggerEnter2D () {
AudioSource.PlayClipAtPoint(sound, transform.position);
ani.enabled = true;
if(!ani.isInitialized)
{
ani.Rebind();
}
}
Comment
Your answer
Follow this Question
Related Questions
Cannot get an animation to play upon key press 0 Answers
Animator Check the end of an animation 1 Answer
Animator Position VS Script Vector 3 0 Answers
I need Function to be in other script 1 Answer
Movement and Jump with animator 0 Answers