Play animation on mouseclick
Hi, I'm currently working on making my first ever game. I have very little experience in coding, but want to give it a try anyway. In my game I want to be able to open and close doors and windows and so on. I've made an animation of a window opening and want to be able to open it when i'm in a certain distance of the window by clicking on the mouse. I've seen a lot of videos on youtube tried a lot of scripts given by others but I simply can't make it work!
What javascript commands are used to say "when clicked on left mousebutton" and "Play animation on this object"?
I do now if statements and so on so I would be able to make a script saying something like when open and when closed, but I just don't know the two commands I've asked for.
Can anyone please help :)?
//Edit: I'm using Unity 2017 btw and prefer javascript :)
Your answer
Follow this Question
Related Questions
How to make a animation play when I press a key 1 Answer
Clarifaction needed on LoadLevel delay. 1 Answer
Set Bool to false after seconds? 2 Answers
How To Add Animations Through C# Scripts 0 Answers
Play animation on mouse click 1 Answer