using UnityEngine; public class Player_01 : MonoBehaviour { public float racketSpeed; public string Inputname; private Rigidbody2D rb; private Vector2 racketDirection; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { rb = GetComponent(); } // Update is called once per frame void Update() { float directionY = Input.GetAxisRaw(Inputname); racketDirection = new Vector2(0,directionY).normalized; } private void FixedUpdate() { rb.linearVelocity = racketDirection * racketSpeed; } }