- Home /
Question by
bill18ization · Apr 10, 2014 at 06:01 AM ·
animationtriggertextbox
How to play an animation on button press only in trigger stay?
Consider a gun present on a table. If I go near the gun a message box must be displayed which informs the user to press 'F' to select the gun. Only when this message box is displayed must the animation for the gun selection be played on hitting the 'F' key.
Could some one help me out with the code for this?
Comment
Answer by koray1396 · Apr 10, 2014 at 08:37 AM
for c#
void OnTriggerStay(Collider col){
if(Input.GetKeyDown(KeyCode.F){
//Animation and method here...
}
}
Your answer
Follow this Question
Related Questions
Attack Animation Trigger 1 Answer
Where is the problem? 0 Answers
How do I trigger an animation using a button? 3 Answers
Help with making an animation play for X amount of seconds? 1 Answer
play a door animation with collider 1 Answer