Changing/adding code to function will make the void not work anymore

I have a recurring problem with adding code to unity. Every time I add code to something, it won’t work after I add the code, even if I delete the code. For example,

new code:

 if(switchSidesToggle.isOn)
            {
				if (team1Button.position == leftButtonPos)
                {
					team1Button.position = leftButtonPos;
					team1SetPos.position = leftSetPos;
					team1TimeoutTrans.position = leftTimeoutPos;
					team2Button.position = rightButtonPos;
					team2SetPos.position = rightSetPos;
					team2TimeoutTrans.position = rightTimeoutPos;
				} else
                {
					team1Button.position = leftButtonPos;
					team1TimeoutTrans.position = leftTimeoutPos;
					team1SetPos.position = leftSetPos;
					team2Button.position = rightButtonPos;
					team2TimeoutTrans.position = rightTimeoutPos;
					team2SetPos.position = rightSetPos;
                }
            }

old code:

 if(switchSidesToggle.isOn)
            {
				if (team1Button.position == leftButtonPos)
                {
					team1Button.position = leftButtonPos;
					team1TimeoutTrans.position = leftTimeoutPos;
					team2Button.position = rightButtonPos;
					team2TimeoutTrans.position = rightTimeoutPos;
				} else
                {
					team1Button.position = leftButtonPos;
					team1TimeoutTrans.position = leftTimeoutPos;
					team2Button.position = rightButtonPos;
					team2TimeoutTrans.position = rightTimeoutPos;
                }
            }

The thing that changes are the team1SetPos and team2SetPos code. As soon as I added these to my code, it started to not switch sides at all. Can someone help me?

Both versions of yoru code don’t switch anything. Both cases do exactly the same. You most likely have copied the code inside the if into the else body without adjusting it. In both cases team1Button is set to the leftButtonPos and team2Button to the rightButtonPos.