I am trying to make a js script that will play an animation when "Fire1" is pressed. I am not sure how to write that kind of script. Could someone please share a full code with me on how to do that?
asked May 29 '10 at 06:12 AM
Two steps: First, check for the fire button. Second, activate an animation.
So create a script, and in the Update function that's placed in there, add the following:
This script assumes that the animation in question is on the same object as the script, if not then you need to link to the target object with a variable.
For more detail on any function, select or type its name in the code editor and press F1. This brings up the Unity Reference for explanation and examples of the classes and functions.
answered May 29 '10 at 09:06 AM
so i found this post while searching for advice with my script, i have two different object each with animations on them and i want each of them to play there animations when fire1 is pressed. but when i give the objects this code they both play when i click on one, how do i change it so i can use the same code but have it so that only when you click on the specific object then it plays the animation?
How would you implement this in the above script?