using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMove : MonoBehaviour { float horizontal = 0f; float vertical = 0f; void Update() { horizontal = Input.GetAxis("Horizontal"); vertical = Input.GetAxis("Vertical"); } void FixedUpdate() { GetComponent().velocity = new Vector2(horizontal, vertical) * 5f; } }