Player Movement and X-Axis Disfunctioning

Hey there, first the code is:

using UnityEngine;
using System.Collections;

public class Player_Move : MonoBehaviour {

	public float maxSpeed = 10f;
	bool facingRight = true;

	void FixedUpdate(){
		float move = Input.GetAxis ("Horizontal");

		GetComponent<Rigidbody2D> ().velocity = new Vector2 (move * maxSpeed, GetComponent<Rigidbody2D>().velocity.y);

		if (move > 0 && !facingRight)
			Flip ();
		else if (move < 0 && facingRight)
			Flip ();


	void Flip(){

		facingRight = !facingRight;
		Vector3 theScale = transform.localScale;
		theScale.x *= -1;
		transform.localScale = theScale;



The problem is when character moves, for example if x axis is 1 and when I press right arrow, character goes instantly to, say 10 in the x axis and vice versa. It basically teleports. Kinda cool but not the thing I need.

Any ideas?

If you’re trying to move the rigidbody, try using AddForce() instead of directly setting the velocity. This can cause unexpected behavior otherwise.
Also if you’re looking to gradually move something, you should generally multiply it by Time.deltaTime or Time.fixedDeltaTime:

So this:

move * maxSpeed 

//Would become 

(move * maxSpeed) * Time.deltaTime