Transform.position not working

Ok so this is a weird one, and probably just something silly that I’m overlooking.
I have four AI characters that hunt and kill each other in a small environment.

When one is dead they are supposed to find the nearest spawn point and move there in order to continue. I don’t want to instantiate them as at this point the gameobject for each character has already been input to several other scripts and I’d rather not have to go through inputting a new gameobject everytime somebody dies.

It should be as simple as changing transform.position to the position of the spawn point shouldn’t it?
Unfortunately, for some reason that escapes me, if there is a wall in between the point of character death and the spawn point they are (instantly!) moving to, they hit this wall and stop?!

What I end up with is a character being killed and moving to a wall, killing the other character which also moves a wall, and the process repeats, with neither ever actually being moved to the spawn point.

Here is a graphic to demonstrate:

…and here is the code snip which is doing this.

public void GotShot()
	{
		float distance = Mathf.Infinity;
		Vector3 myPosition = transform.position;
		
		//find the closest spawnpoint
		foreach(GameObject spawn in AllSpawns)
		{
			Vector3 directionToNode = spawn.transform.position - myPosition;
			float dSqr = directionToNode.sqrMagnitude;
			if(dSqr < distance)
			{
				distance = dSqr;
				closestSpawn = spawn.transform.position;
			}
		}
		//Damage Health
		health -= 25;
		if(health < 1)
		{
			float a = closestSpawn.x;
			float b = closestSpawn.y;
			float c = closestSpawn.z;

			//Move to exact spawn location
                    //Vector coordinates being put in singly, manually.
                    //Walls between death point and spawn point should be
                    //irrelevant because this is not a Lerp or a Translate or any
                    //other similar movement, it is a direct input to the character's                         
                    //transform figures?!

			Vector3 goToSpawn = new Vector3(a,b,c);
			transform.position = goToSpawn;
			navAgent.SetDestination(transform.position);
			health = 100;
			state = AIState.stateIdle;
		}
	}

At first glance, calling SetDestination in line 34 stands out to me. Do you really need to do this? If so, I’m guessing there is some internal cached value for the transform.position in the nav agent. So even though you are setting transform.position just above this, it may still be reading the previous position and computing a LOS path from there to the spawn point, thereby hitting the wall a few frames later. You could try switching lines 33 and 34. Or removing line 34 unless you really need it.

Most likely you just want to call navAgent.Stop() followed by navAgent.Warp(goToSpawn);