The unit name does not update on every grid

I can cant seem to find the script that is causing this issue. I have completed “Grid Visual” in Actions and UI and I still cant get the Unit name to update as I move from Grid (visual) to grid. It updates on some but not most.
All the gameplay (such as it is) selecting, moving, displaying valid grid squares is all great. I know this will probably be addressed at some point (probably the next lesson with my luck), but it makes me crazy (and hard to concentrate) when I cant find the answer to this type of basic issue.
Thanks-

By “Unit name” you mean the debug objects don’t show that a Unit is on that position? How does it update sometimes but not always? What is the common thing between when it doesn’t work versus when it does work? Do you ever see duplicates, meaning two grid positions showing the same Unit reference?
Can you post a video?
Sounds like the issue is somewhere within your Unit logic not correctly updating the grid when it changes Grid Position.

I found the problem! As usual it was operator failure and in the last place I rechecked :-)…
When we were creating the GridPosition Struct, I was having problems getting Visual Studio to accept return !(a == b), so I tested a.x != b.x && a.z != b.z and it seemed to work (I had no problem selecting units, activating visuals detecting grids etc).
Having gone back through every script line by line and checking anything I had re-written using my own conventions, I checked the git version of the GridPosition struct and saw that you were only using using System and after I changed that, I was able to change static != operator to return !(a == b) and that did it.

Forgot to say: Thanks for your reply Code Monkey… It did motivate me to go back and check my flawless coding again (again(again)) :slight_smile:

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

Privacy & Terms