My PlayerController script doesn't work

Here’s my script below.

But when I press arrow key, my player object doesn’t move.

It’ll be my pleasure if you tell me the problem of this code

or some settings in unity that I have to fix.


using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

	public float speed;

	private Rigidbody rb;

	void Start ()
	{
		rb = GetComponent<Rigidbody>();
	}

	void FixedUpdate ()
	{
		float moveHorizontal = Input.GetAxis ("Horizontal");
		float moveVertical = Input.GetAxis ("Vertical");

		Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

		rb.AddForce (movement * speed);
	}
}

Make sure your Input Axis are configured (they are default WASD I believe, but maybe print them just in case) and like the first comment said, also make sure that your speed value is defined, and experiment with higher values for that if it’s still not working, since this is a force and there might be friction counter acting it.

I cleared [player component] - [rigid body] - [Is kinetic] check box

and it worked!

Anyway, thanks for all comments!