Unity 5 Navmesh Agent Issue Parable

For anyone who cares, as in you’ve been searching and working for over an hour trying to find someone else with the same issue because the issue seems to make no sense, I am recording this here:

So you have a navmesh and a navmeshagent and you notice that your navmeshagent goes to a corner [say (0,0,0) for instance] of the navmesh it’s touching. But only SOMETIMES. Say you hit play 20 times, it might work 11 times and 9 times it will instantly pop into a corner and not be able to move from there. And so you try MANY things and you remove many things and you add many things and you code some initializations and you debug a bunch of positions and targets and other nonsense. And you make new test scenes. And prefabs to bring back. And you go slightly crazy. But the important thing here is, I did NOT make this giant scene with five million objects, nor create the navmesh implementation in the first place. I am just the unlucky programming lead who gets to solve the issue as it is given to me. So forget my headaches, here’s my solution:

You should NOT have a navmesh obstacle parent that has a navmeshobstacle child!!!!! If you do, weird things happen! So yes, in the middle of the crazy scene I located such a grotesque creature — sadly this eventually happened by enabling one object at a time in the scene until the glitch was triggered.

So if you have a weird disappearing/jumping/trapped random navmesh agent, perhaps that’s your problem too.