I’m making a 2d platformer and I followed Blackthornprod’s tutorial on character controller. In his code it had the function to flip the character when moving in different detections but the code was different since the character was made of multiple sprites, yet the flipping mechanism wasn’t working, so I tried tutorials on how to normally flip the character but that didn’t work either. I want to know if someone has a solution to my problem ,
Make an array/list of all of the sprites for your object, and then use a foreach loop to flip them individually. You can either multiply their x-axis scale by -1, or use the included SpriteRenderer.flipX variable.
public SpriteRenderer[] renderers;
public bool defaultFacingRight = true; // Which way your sprite faces naturally
private bool facingRight = true; // Set this bool when changing directions
public void FlipSprites ()
{
foreach (SpriteRenderer rend in renderers)
{
rend.flipX = (defaultFacingRight != facingRight);
}
}