hello, This code Reverse animation for only once , if we click another time it does not working.
Script 1 for animation when click on 3Dtext[box collider]
var playing : boolean = false;
var gameobject : GameObject;
function OnMouseDown ()
{
if (!playing) {
playing = true;
gameobject.animation["Credit"].speed = 1.0;
yield WaitForSeconds(gameobject.animation["Credit"].length);
playing = false;
}
}
script 2 for reversing animation on clicking 3Dtext [Boxcollider]
var playing : boolean = false;
var gameobject : GameObject;
function OnMouseDown ()
{
if (!playing) {
playing = true;
gameobject.animation["Credit"].speed = -1.0;
yield WaitForSeconds(gameobject.animation["Credit"].length);
playing = false;
}
}
This thing is working good but here’s my problem if user click again on the script1 text animation i mean after clicking on Script2 which reverse animation when it comes back to original state clicking on script1 text doesn’t work …
thank you