Answer the question
In order to leave comments, you need to log in
How can I rotate all child 2d objects?
There is this code
if (joystickMoving.Horizontal < 0f)
{
spriteRenderer.flipX = true;
int count = transform.childCount;
for (int i = 0; i < count; i++)
{
if (transform.GetChild(i).tag == "Head" || transform.GetChild(i).tag == "Leg")
{
SpriteRenderer sprit = transform.GetChild(i).GetComponent<SpriteRenderer>();
sprit.flipX = true;
}
}
}
else if (joystickMoving.Horizontal > 0f)
{
spriteRenderer.flipX = false;
int count = transform.childCount;
for (int i = 0; i < count; i++)
{
if (transform.GetChild(i).tag == "Head" || transform.GetChild(i).tag == "Leg")
{
SpriteRenderer sprit = transform.GetChild(i).GetComponent<SpriteRenderer>();
sprit.flipX = false;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question