using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
[SerializeField] private float _speed;
private Vector3 _input;
private Rigidbody2D _rigidbody;
private void Start()
{
_rigidbody = GetComponent<Rigidbody2D>();
}
private void FixedUpdate()
{
move();
}
private void move()
{
_input = new Vector2(Input.GetAxis("Horizontal"), 0);
_rigidbody.addForce(_input * _speed);
}
}