I have a problem. The player does magic when you hold down the space key. I want the player to detect enemies at a certain distance and play an effect on them while the button is pressed.
For this, I tried the raycast and the instantiate method, but it plays in every frame because it is called inside the update function. But I just want only one effect to play on enemies while the button is pressed. I don’t know if I could explain what I mean. But how should I go about it?
I’m new to unity. I have to do this project for my final exam. Thanks in advice.
Here is the picture; cloning effects constantly.