scale flip not showing

Something is making my sprite flip back when i scale flip it on the x axis to show it going the opposite way. But i cant figure out what it is! This is the code

		protected void CheckForSpriteFlip ()

				var flip = false;
				//check if sprite needs to flip
				if (movement > 0 && !IsFacingRight)
						flip = true;
				if (movement < 0 && IsFacingRight)
						flip = true;

				if (flip) {
						Vector3 flipScale = transform.localScale;
						flipScale.x *= -1;

						transform.localScale = flipScale;
						IsFacingRight = !IsFacingRight;

When i set print(“”) before and after it shows that the xscale is 1 before the flip and -1 after the flip. But no change shows. And the next time the flip is executed it says the same thing. scale 1 before the flip and then -1 after the flip. So something is flipping it back as soon as it has been flipped to -1. I can also se in the editor that the scale is in fact never -1.

What could do this? I have certainly not coded it.


I now tried with this in the Awake()

		protected override void Awake ()
				base.Awake ();
				PlattformGameManager.Martha = this;
				MaxSpeed = 4.0f;
				transform.localScale = new Vector3 (2, 2, 2);
				print (;

But still when the object appears its scale is 1.


When running the game, i pause, rescale the object with the editor. It works. Moment i run the game the scale is reset to 1, 1, 1. What is this sorcery?!

You could just simplify the whole thing like this:

void Flip()
	//flip character direction
	if(movement > 0){
		transform.localScale = new Vector3(-1,transform.localScale.y,transform.localScale.z);
	else if (movement < 0){
		transform.localScale = new Vector3(1,transform.localScale.y,transform.localScale.z);

I’m guessing elsewhere in your movement script for actually moving the character, you’re already checking for “movement”, so in that check, just place Flip(); for when the character is moving.

edit: Also, how come you’re using Vector3’s if you’re working with Sprites? Sprites only require a Vector2 for all translation and scaling.