Need help with "warning CS0414: The field 'PlayerController.movement' is assigned but its value is"

i have been following along a tutorial series on how to make a 2d game (Very simple). I have done exactly as the video says, compared code and they are identical but i get this error? “warning CS0414: The field ‘PlayerController.movement’ is assigned but its value is never used” i would appreciate any help. Here is the code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour {

    public float speed = 5f;
    private float movement = 0f;
    private Rigidbody2D rigidBody;

    // Start is called before the first frame update
    void Start() {
        rigidBody = GetComponent<Rigidbody2D> ();   
    }

    // Update is called once per frame
    void Update() {
       
    }
}

Please remove as it is fixed

Can somone help me

Please don’t necro-post to old threads. Start your own post… it’s FREE!

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

imagine if it wasn’t… O.o

The warning is just a warning. You have a variable X, and you set X = something, but nowhere else in the code seems to care about it. It’s saying you have some gas in the tank, but you never drive the car. This could point to a mistake you may have made with your logic.

If this is your code and you don’t want to use that variable X, get rid of it.

If it’s in an asset script you downloaded, or you have future plans for the variable, you can put the following line somewhere near the top of the offending script:

#pragma warning disable 0414 // assigned but never used