The hot fix that has us extend the collider does not work for me because the colliders in other lanes are starting to touch and causing problems like the attacker above a defender attacking them, here are some pictures I show my code in it as well but here is my code pasted out, let me know what else you need!
As it seems, the background does not line up with the grid in the background. Furthermore, check where the other game objects get spawned. Their colliders must not overlap the tile. If necessary, also check the root game object (Spawers). It must be set to (0, 0, 0).
If nothing helps, please rewatch lecture “Set Up Background Playspace” and the following, and compare your settings to Rick’s. Maybe there is a difference somewhere.
Thank you for your response! this has helped somewhat, I had moved the game object’s transform and the body, so I have fixed that, but I still have the problem with clicking and overlap.
In this screenshot, you can see Unity’s grid and my collider, I moved my back ground in order to try and show where my collider is compared to the unity grid:
I went back and reset all transforms on the defenders and not it works! turns out the crosses are the units, not the squares! i feel so silly, thank you for your help, I would have never though to edit my defender’s positions. I am so used to the square being the unit and not where they cross. is that a setting? or something specific in unity?
Well, maybe it helps to regard World Units like the real world unit metre (or mile or whatever you prefer). If there is a square with a size of 1 x 1 metre, is the centre automatically at (1, 1)?
While 1 of the grid tiles has got a size of 1 x 1 WU, the coordinates don’t refer to a tile but to an origin point, which is defined as (0, 0, 0). In Unity, that origin point is located on a cross. That’s why the centre of the a tile is at (x.5, y.5), where x and y are just rounded coordinates.
If there were half pixels in the pixel art programs, the result would probably be the same as in Unity. How the result looks also depends on where the pivot point of the pixel (or sprite) is.