I put a Sprite/Diffuse Material on my Player.
In the scene, before starting the game it looks ok (1st screenshot).
After starting the game it still works fine, but when I am starting to move the player on x-axis the it becomes black (2nd screenshot).
Why?
This is the script I use to transform the Player's position and scale:
void Update()
{
Move();
{
float moving = Input.GetAxis("Horizontal");
characterAnim.SetFloat("Speed", moving);
}
}
void Move()
{
if (Input.GetKey("right"))
{
transform.localScale = new Vector2(1, 1);
transform.Translate(Vector2.right * speed * Time.deltaTime);
}
if (Input.GetKey("left"))
{
transform.localScale = new Vector2(-1, 1);
transform.Translate(Vector2.right * speed * Time.deltaTime);
}
// rb2D.AddForce(transform.up * 20);
}