Hello,
I’m unsure why Gary changed the Action Type of the Fire action from Button to Value even with his explanation. Could someone else please explain? Thank you.
Hello,
I’m unsure why Gary changed the Action Type of the Fire action from Button to Value even with his explanation. Could someone else please explain? Thank you.
Hi ttgm,
Welcome to our community, and thank you for your question!
Gary’s idea was to make the player be able to shoot continuously while the ‘fire’ key/button is being pressed down. From what I see in the Unity manual, Value does what Gary needs for his solution.
This is what the manual says about the Button value:
Use this for inputs that trigger an Action once every time they are pressed.
Unless I misinterpreted this information, we would be able to make the player shoot only once with Button even if the ‘fire’ key/button is being pressed down for multiple seconds. We would have to press the button/key again each time we want to make the player shoot.
Both ideas, making the player shoot continuously and making the player shoot only, are completely fine but they are mutually exclusive. You have to choose one of the ideas.
You can easily check the difference between Value and Button with a Debug.Log in your code. Then go with the solution that works best for your specific problem/idea.
See also:
Thank you so much, I think I understand the concept better now, and I’ll definitely try out the differences between them using Debug.Log as you’ve suggested.
Yes, do that, please. It’s the best way to learn how Unity works. Reading the manual is nice and all but seeing what happens is even better.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.