Adjusting location on save to avoid infinite loop.

Here’s the situation. I have a trigger script that saves your game and loads another map. That works just fine, the problem is that it saves right on the trigger, so when you go back to the previous map, it loads the other map. I wanted to save an offset so you would transform to one or two spaces before the trigger primitive. Only it’s not saving for whatever reason.

public void PlayerAdjust(float CoordX, float CoordY, float CoordZ,  float amount, string axis) //float Rotation,
	{
		Debug.Log("X " +CoordX);
		Debug.Log("Y " +CoordY);
		Debug.Log("Z " +CoordZ);
		switch(axis)
		{
		case "x":
			CoordX=CoordX + amount;
			Debug.Log("calc X" +CoordX);
			
			break;
		case "y":
			CoordY=CoordY + amount;
			Debug.Log("calc Y" +CoordY);
			
			break;
		case "z":
			CoordZ=CoordZ + amount;
			Debug.Log("calc Z" +CoordZ);
			
			break;
		}
		Save();
	}

Here is the player adjust script. Do I need a return type?

Here is the Save function:

public void Save()
	{
		var Personal=new JSONObject
		{
			{"Name" , PlayerName}, 
			{"Gender" , Gender }, 
			{"Body Type" , BodyType},
			{"Alignment" , Alignment},
			{"Guild" , Guild }, 
			{"Rank" , Rank },
			{"Form" , Form},
			{"Health" , Health},
			{"Hunger" , Hunger},
			{"Thirst", Thirst},
			{"Intoxication" , Intoxication},
			{"Fatigue" ,Fatigue},
			{"Encumbrance" , Encumbrance},
			{"Experience" , Experience}
			
		};
		
		var Stats = new JSONObject
		{
			{"Constitution" , Constitution},
			{"Strength" , Strength},
			{"Stamina" , Stamina},
			{"Dexterity" , Dexterity},
			{"Intelligence" , Intelligence},
			{"Wisdom" , Wisdom},
			{"Focus" , Focus},
			{"BattleSpeed" , Battlespeed}
		};

		var Vitals = new JSONObject
		{
			{"Life" , Life},
			{"Energy" , Energy},
			{"Endurance", Endurance}
		};
		
		var Skills =  new JSONObject
		{
			{"Light Melee Weapons" , LightMeleeWeapons},
			{"Medium Melee Weapons" , MediumMeleeWeapons},
			{"Heavy Melee Weapons" , HeavyMeleeWeapons},
			{"Light Ranged Weapons" , LightRangedWeapons},
			{"Medium Ranged Weapons" , MediumRangedWeapons},
			{"Heavy Ranged Weapons" , HeavyRangedWeapons},
			{"Light Armor" ,LightArmor},
			{"Medium Armor" ,MediumArmor},
			{"Heavy Armor" , HeavyArmor},
			{"Holy Armor" , HolyArmor},
			{"Holy Weapon",HolyWeapon},
			{"Wicked Armor" ,WickedArmor},
			{"Wicked Weapon",WickedWeapon},
			{"Block", Block},
			{"Parry" , Parry},
			{"Evade" , Evade},
			{"Critical Hit" ,CriticalHit}
			
		};
		
		var Money = new JSONObject
		{
			{"Copper" , Copper},
			{"Silver" , Silver},
			{"Gold" , Gold}
		};
		
		var Location = new JSONObject
		{
			{"Map", Application.loadedLevel},
			{"X" , CoordX}, 
			{"Y" , CoordY},
			{"Z" , CoordZ}

//			{"Rotation" , Rotation}

		};
		Debug.Log("Saved X" + CoordX);
		Debug.Log("Saved Y" + CoordY);
		Debug.Log("Saved Z" + CoordZ);

		var Player = new JSONObject
		{
			{"Personal" , Personal},
			{"Stats" , Stats},
			{"Vitals" , Vitals},
			{"Skills" , Skills},
			{"Money" , Money},
			{"Location", Location}
		};
		
		Debug.Log(Player);
		File.WriteAllText(Application.dataPath + "/Player.json", Player.ToString());
	}

I wanted to set it up so that depending on where you were facing it would move you off the trigger on either x, y, or z. That’s what the switch/case was all about. Also wanted to swing the player around so they are facing 180 degrees from the trigger(door) as if they came out. If that makes more sense.