Hi I need to know how to run an animation on a mouse click. For example I have a scene that has an animation on the camera, plus I have a button with a box collider at the bottom right of my scene, so here’s what I want to happen, when I click play I want it so when I click my button(that has the box collider on it) I want it to play the animation I assigned to my camera. And if you can please write the code in java it would be awesome. Thanks so much.
Animation name = CameraAnimation1
Camera name = MainCamera
function OnMouseOver()
{
GetButton("Fire1")) // GetButtonUp("Fire1")) - GetButtonDown("Fire1"))
{
GameObject.Find("buttonPlay").animation.Play("ButtonAnim");
/* "buttonPlay" the button to press to start the animation
"ButtonAnim" the animation of pressed button
if there is, if not remove the string above
*/
animation.Play("NameOfAnimation");
}
}