I’m new to Unity, and Learning C# along with it. It’s going stellar, this is significantly easier than I thought it would be. I’m going to be as clear as I possibly can, because I’ve noticed a lot of people on this forum don’t make their problem clear enough, and that just makes things confusing for everyone.
There’s one thing I can’t seem to find however. In other languages I’ve used, there’s usually some sort of “Only one action when event loops”, or “Trigger Once” type event. For example, if you have it so that your character makes a sound effect when he drops off a platform by checking if he is in the air, it doesn’t play the sound effect 6 million times until he lands.
With what I’m working with right now, I have it so once you tap your joystick at a specific speed, your character gets put into a “Dash” action, where there is a countdown timer to tell the character how long it should be in “Dash”. The problem is that once the condition to Dash is met, the timer will stay at what I set it to, because it’s updating every frame. I need it so that the event is only tiggered once, so the DashTimer can subtract like I have it set to do. Any ideas? I’ll write some crappy pseudo code modeled after another language I know that has this function:
-KeyRight( “Player_Input” ) == 1
Set Action( “Player” ) to “Walk”
All this does is set the player’s action to Walk when you press right, and it keeps it that way.
-Only One Action when Event Loops
-KeyRight( “Player_Input” ) == 1
PlaySound.( “Step” )
This one is different. When you press right, it plays the step sound effect, but only once. This is what I’m going for.
Any help is greatly appreciated!