Roll A Ball: Can't get ball to move. Did not make same error as earlier posters.

Hello, I have read through all of the similar questions and I am not making the same errors as they are, so I hope someone will treat this as a new question. The demo itself has been changed since people stared asking questions about it. I believe my code is letter for letter as shown in the demo but I don’t have a practiced eye so I guess I am missing something. Based on what I read below, I have also checked over “Horizontal” and “Vertical” axes in the Input Manager.

I have successfully created past projects where I moved GameObjects using the mouse.

Here is my code:

using UnityEngine;

using System.Collections;

public class PlayerContoller : 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);


(Note I did try to set “speed” variable to different amounts in Inspector)

Can anyone tell me what I am doing wrong? Thx

maybe you haven’t add the component script into your gameobject?


I had checked that the script was attached yesterday in response to tanoshimi’s answer above. But when I opened the project today to check this again, I didn’t see the gameobject in the scene or the object’s name in the hierarchy. Then I clicked on the scene name in the project pane. The object (and the other elements I had made) showed up and also the keys worked to move the object. There is only one scene and I thought it was active by default? But maybe I bungled that somehow. In any case it works now!