- Home /
Question by
ShareTheRainbow · Mar 06, 2011 at 12:53 PM ·
animationonmouse
Animation plays just once "OnMouseEnter"
Hey Guys.
I have a locker and, when I go on MouseEnter the door of the locker opens and when i go out of the Collider the door closes, but if I try it again it doesn't play anything
I got this Script
var pos : Rect ; private var showButton : boolean = false;
function OnMouseEnter() { animation.Play ("Default Take"); }
function OnMouseExit() { animation["Default Take"].speed = -1.0; }
function OnMouseDown() { showButton = true; }
function OnGUI() { if(showButton) { GUI.Box ( Rect (0,0,200,100), "Text hier" ); } }
Comment
Best Answer
Answer by Statement · Mar 06, 2011 at 01:46 PM
Try set the speed to 1.0
since you set it to -1.0
during OnMouseExit
.
function OnMouseEnter()
{
animation["Default Take"].speed = 1.0;
animation.Play ("Default Take");
}