scripting issues

hi, I am trying to make a new game ( similar to the Roll a Ball tutorial game but with more features, different materials colours etc.) anyway, I was trying to write the script to move the player when I ran into a problem, i was writing this :

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
{
    private Rigidbody rb;
    public float speed;

    void Start ()

    {
        rb = GetComponent<Rigidbody> ();
    }

    void FixedUpdate ()
    {
        float movehorizontal = Input.GetAxis ("Horizontal");
        float movevertical = Input.GetAxis ("Vertical");

        Vector3 = new Vector3 (movehorizontal, 0.0f, movevertical);

        rb.AddForce (movement * speed);
    }
}

just incase what i suspect the problem is doesnt show, the problem is that movement is underlined red in the line rb.AddForce (movement * speed);
im not sure is this is what the problem is but there isnt anything to help me out in the footer of the unity page im working on, it only says " All complier errors have to be fixed befor you can enter playmode "
please help me, sorry if i sound really desperate, im not that desperate, i would just really like to know how to fix my problem as im out of ideas, as far as i know, evrythings how it should be. by the way, im aware that this script isnt the best, nor is it compleate, just saying in advance…

thanks in advance for the help,
-Reece

Hey there, Reece.

The error is happening because you never define the variable “movement” anywhere in the script. It looks like you just forgot to name it on line 20.

Try this instead:

Vector3 movement = new Vector3(movehorizontal, 0.0f, movevertical);

Hope that helps.

1 Like

thanks for the help mate, i really appreciate it. :wink:

1 Like

No worries, Reece. Just glad I was able to help :). Keep at it!