Children must not flip with parent.

Hello. I’ve got a 2d platformer, and I’ve made character controller by the tutorial from unity’s “Live Training”.

Now I’ve got some problems with it. The movement to the left there realised through flipping X scale of the character, thus making him go left.

  void Flip()
	{
		facingRight = 	!facingRight;
		Vector3 theScale = transform.localScale;
		theScale.x  *= -1;
		transform.localScale = theScale;


	}

But here’s a problem. When character moves left, all of his child objects also change their x-scale to -2 (i’ve made them 2.0 obviuosly up from 1), which I don’t want, I want to rotate only parent object, but not the child.

If you can, help me how to make specific child not to flip with parent. Or all of them.
I’ve been googling for 4 hours now, please, help T_T

Iterate through each child and swap them back, as follows

foreach (Transform child in transform){
        Vector3 childScale = transform.localScale;
        childScale.x  *= -1;
        transform.localScale = theScale;
}

I’ve made it more elegant way, without iterating through all of the children:

private GameObject child;

child = GameObject.Find ("SpriteRotate");

Vector3 childScale = child.transform.localScale;
		childScale.x *= -1;
		child.transform.localScale = childScale;

Find() its not recommended to use.
You can create a new script “keepScale” attached to every child you want to keep in scale and do something like this:

var originalScaleToKeep : float; 
   function Start(){
originalScaleToKeep : float = transform.localScale.x;
    }
function Update(){
    transform.localScale.x = originalScaleToKeep;
}