I’ve tripple checked the code changes and I cant figure this out (I hope its something obvious Im not seeing) Everything was working perfectly at the end of the “Enemies & Combat” section. After editing the code in C# generics and Grid system generics the grid visuals dont behave correctly. Im attaching a couple of screen grabs. 1) after simple unit move and 2) after enemy moves and shoot is selected.
Could you share the code for your GridObject.cs
and the bits you changed on the GridSystem
? It looks like something is not right in LevelGrid
(perhaps) and it’s failing to do AddUnit
and RemoveUnit
properly (sharing LevelGrid.cs
may be helpful, too)
Seems you have some issue when Units move, you’re not removing them from the previous position, just adding onto the new position so you end up with several positions with no Unit there but the grid system still thinks they’re there.
Check your Unit moved GridPosition logic, add a Debug.Log to see if the code is running. Also add a log on the GridSystem itself to test if it’s Adding/Removing units correctly.
Thanks for your suggestions Hugo and thanks to bixarrio too for his comments. I checked and re-checked all my code and couldnt find any errors, so I went back and re-typed the first generic changes in a copy of the original Unit script and everything worked immediately. Apparently the issue was in the line public T GetAction() where T: BaseAction.
Weird, but the angle brackets with the T after GetAcion disappears when I type it here… maybe a markup issue but not what was happening with my code:-)
Even thought I had checked it seveal times, the act of re-typing the function fixed it and restored my sanity.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.