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