Private Field is assigned but its value is never used, but i use it

Hello everybody, i’m working on a 2D Platformer for Android and i’ve got a problem with my code it says i dont have the moveVelocity assigned but in my eyes i’m using the field later in my code.
I don’t know where the problem is.

I hope you could help me out.

I get this Error :

Assets/Scripts/PlayerController.cs(8,16): warning CS0414: The private field`PlayerController.moveVelocity’ is assigned but its value is never used

Here is my Code :

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

public class PlayerController : MonoBehaviour {

	public float moveSpeed;
	private float moveVelocity;
	private Rigidbody2D myRiBo;

	public Transform groundCheck;
	public float groundCheckRadius;
	public LayerMask whatIsGround;

	public bool isGrounded;

	private Animator myAnim;

	public Vector3 respawnPoint;

	public LevelManager theLevelManager;

	// Use this for initialization
	void Start () {
		myRiBo = GetComponent<Rigidbody2D> ();
		myAnim = GetComponent<Animator> ();

		respawnPoint = transform.position;

		theLevelManager = FindObjectOfType<LevelManager> ();
	}
	
	// Update is called once per frame
	void Update () {

		// Ground Check for the Player
		isGrounded = Physics2D.OverlapCircle (groundCheck.position, groundCheckRadius, whatIsGround);

		Move (Input.GetAxisRaw ("Horizontal"));

		myAnim.SetFloat ("Speed", Mathf.Abs (myRiBo.velocity.x));
		myAnim.SetBool ("Grounded", isGrounded);

		// Check wich direction the Player should look
		if (myRiBo.velocity.x > 0) {
			transform.localScale = new Vector3 (1f, 1f, 1f);
		} else if (myRiBo.velocity.x < 0) {
			transform.localScale = new Vector3 (-1f, 1f, 1f);
		}
	}
		
	public void Move (float moveInput) {
		moveVelocity = moveSpeed * moveInput;
	}

	// If player is Grounded and want to Jump then Change Gravity
	public void Jump () {
		if (isGrounded) {
			GetComponent<Rigidbody2D>().gravityScale *= -1;
			transform.Rotate(0, 180, 180);
		}
	}
}

In the code you posted you only write to the variable but never actually read from it again. That’s what the warning message tells you.

And since the variable is private no other class can access it so I’m assuming you didnt just forget to post some other code.

“but in my eyes i’m using the field later in my code”

if you mean that you still need to implement that then you should probably do that.