Play Camera animation when you OnMouseDown into another object

:face_with_spiral_eyes: So The problem is that I know what I have to do but I just don’t know how it will be done , let me explain. I’m making a main menu so when I click Options this animation should play that will move the camera. I already made the animation . But the problem is that I don’t know if I will be doing the GetComponent function for the script . so when I attach it to the Options gameobject in the inspector view it will play the animation that belongs to the camera not the box. Is their another way to do this and how would the code look if I had to inherit the animation from the GetComponent’s function. :razz: Please respond

Bump

Bump

I dont completely understand you situation, but it seems like you could just have a script that you attach to each button of the menu. In that script you could make a public GameObject named thecamera or whatever and drag your camera into that variable in the inspector. Then you could have an OnMouseDown function in the script, and in that function have

thecamera.animation.Play(“NameofAnimation”);

If I am understanding what you are asking correctly then that would work, but Im not sure I am understanding the question. Also I can think of at least one or two more ways to do this, depending on the situation but Im not completely clear on the situation.

Sounds interesting, Ill try it.