вот такая ошибка
Assets\scripts\Player.cs(46,9): error CS0106: The modifier ‘public’ is not valid for this item
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float speed;
public float normalSpeed;
public float moveInput;
private bool facingright = true;
private Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
if (!Player2.lose)
rb.velocity = new Vector2(speed, rb.velocity.y);
{
if (facingright == false && moveInput > 0)
{
Flip();
}
else if (facingright == true && moveInput < 0)
{
Flip();
}
}
public void OnLeftButtonDown()
{
if (speed >= 0f)
{
speed = -normalSpeed;
}
}
public void OnRightButtonDown()
{
if (speed <= 0f)
{
speed = normalSpeed;
}
}
void Flip()
{
facingright = !facingright;
Vector3 Scaler = transform.localScale;
Scaler.x *= -1;
transform.localScale = Scaler;
}
}
}