- Home /
Question by
kbeaud · Feb 13, 2013 at 05:26 PM ·
animationjavascriptfunctiongame object
Camera Move
So I have a cube, and when I press the cube I want to activate an animation. Only problem is the animation is on a different object. Here is my code so far:
function OnMouseDown() {
if(GameObject.Find("Main Camera"))
animation.Play("Move_Camera1");
}
Comment
Answer by robertbu · Feb 13, 2013 at 06:01 PM
Assuming the animation is attached to the camera (untested):
function OnMouseDown() {
var go = GameObject.Find("Main Camera"))
if (go != null)
go.animation.Play("Move_Camera1");
}