
void Start()
{
if (Input.GetMouseButtonDown(0))
{
toword *= -1;
direction *= -1;
void update()
{
if (Input.GetMouseButtonDown(0))
{
toword *= -1;
direction *= -1;
}
if (transform.position.x < 2.8f)
{
direction = -0.05f;
toword = -1.0f;
}
if (transform.position.x < -2.8f)
{
direction = 0.05f;
toword = 1.0f;
}
transform.localScale = new Vector3(toword, 1, 1);
transform.position += new Vector3(direction, 0, 0);
}

맨 밑에 빨간 줄이 왜 생기는지 모르겠네요, 어느 부분에서 오류가 난 건지 보이질 않네요-
