I have a weird problem in my 2D Unity project. I’m using a pathfinding asset for AI movement and it mostly works great. My AI characters find paths correctly and move around obstacles like they should.
But there’s this annoying issue with the z coordinate. Even though I’m making a 2D game, the AI agents keep getting wrong z values as they move. When I spawn an agent at z=0 and tell it to go to a target that’s also at z=0, the agent’s z position keeps changing between about -9 and -1 while it walks the path.
I checked the waypoints and they all show z=0 like they should. The AI prefab starts with transform (0,0,0) and both spawn point and destination have z=0 too. I followed the 2D setup guide exactly and didn’t change any of the pathfinding code.
Has anyone seen this before? What could make the z position go crazy like this when everything else works fine?