Player won't attack enemy

My Player doesn’t move when I click on the enemy. It can move around the board but when I click on the enemy nothing happens.

1 Like

can you provide more information, like screenshot and code snippet?

if you say “nothing happens” when you click on the enemy, we could assume that somehow the raycast is hitting the enemy collider but somewhere in the code the logic breaks… (it’s an assumption that would need to be verified).

Also, try putting a lot of Debug.Log at various stages so you can see where the logic stops doing what you expect…

I’m a noob when it comes to programming so I’m not sure how to debug but here is my PlayerController Script, I also taught it my be an issue with the Raycast but this is exactly how they have it in the github code.

I think the problem maybe somewhere in my Attack method

Your bug is that, in the fighter method, you put everything in the Start() method whereas it should be in the Update() method.

For recap, the Start() method happens once, and only once, whereas the Update() method is called over and over again (once per frame).

2 Likes

Holy crap :man_facepalming:… Thanks dude !

1 Like

You’re most welcome :slight_smile:

Good job working that out!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms