Issues after updating since updating the script in this lesson

The code worked perfect at the end of the last lesson but at the end of this lesson it doesn’t work and its not throwing any errors at all so I’m not sure what’s the issue
So I’ve gone over the code on git and everything seems fine but i must be missing something and for the life of me I cant seem to figure it out .
I have the fighter script on the player and weapon range set to 2( but i have tried various distances) but nothing change my player does not move to the sphere when I click it nothing happens at all. i have attached all the code below can someone please help me out as I’ve been trying to figure it out since last night and I’m starting to go crazy lol, if there is anything else I can provide to help solve the issue please let me know .

thanks in advance
-GraMMaC

combatTarget

followCamera

here is a SS of the player and the enemy inspector


For future questions, please paste the code into the editor directly and format it with the </> button, it will be much easier to read than screenshots, which when viewing on my laptop or tablet leave the text too small to read.

It’s possible from your screenshot that the player is already in range of the enemy.

  • Is your navmesh baked and up to date with your current scene geometry (any time you make a terrain or building change, you need to rebake)
  • What happens if you click to another position on the map?
  • Move the enemy to a different location further away. Does the player try to approach now?

Hi thanks for the quick reply, I tried to bake again and move the enemy to no avail. I am able to click anywhere with the player and he will move to where I clicked however when I click on the enemy sphere the player just wont move there. its like I’m clicking on a spot somewhere on my map that I’m not allowed to go so the player just stays in the same spot,

would you like me to re paste the code the proper way for you?
let me know what I can provide you with that can help

and thank you again for the help its greatly appreciated

Thanks
-Graeme

I looked at the code one more time, and I believe I’ve found the error. In Fighter.cs, your Update method is named update(). The Unity Callback methods (Start, Awake, OnEnable, Update, etc) are case sensitive. This means that the Update is never being called. Try changing it to Update() and things should work correctly.
(Another reason pasting text is more effective than screenshots, large screenshots get compressed by the forums and are hard to read for us older geezers).

Hi Brian, thank you very much. I figured that it was a case sensitive issue somewhere and I looked over the code too many times to count, not sure how I didn’t see it. I just wanted to let you know that that was indeed the issue and that I really appreciated how fast you answered my cry for help.
Thanks Again
-Graeme

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

Privacy & Terms