Keep Getting Error CS0131

Hey so I’m very new to Unity, and know very little code (a lot of what I have was written straight from tutorials), so maybe this is an easy question, but I’m making the basic systems of a 2D platformer and I’m getting this error in my code: Assets/3D Models/PlayerController.cs(21,17): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer. Here is the code (I copied and pasted it, so some things may be a little off):

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(PlayerPhysics))]
public class PlayerController : MonoBehaviour {

// Player Handling
public float gravity = 20;
public float speed = 8;
public float acceleration = 30;
public float jumpHeight = 12;

private float currentSpeed;
private float targetSpeed;
private Vector2 amountToMove;

private PlayerPhysics playerPhysics;


void Start () {
	PlayerPhysics = GetComponent<PlayerPhysics>();
}

void Update () {
	targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
	currentSpeed = IncrementTowards(currentSpeed, targetSpeed,acceleration);
	
	if (playerPhysics.grounded) {
		amountToMove.y = 0;
		
		// Jump
		if (Input.GetButtonDown("Jump")) {
			amountToMove.y = jumpHeight;	
		}
	}
	
	amountToMove.x = currentSpeed;
	amountToMove.y -= gravity * Time.deltaTime;
	playerPhysics.Move(amountToMove * Time.deltaTime);
}

// Increase n towards target by speed
private float IncrementTowards(float n, float target, float a) {
	if (n == target) {
		return n;	
	}
	else {
		float dir = Mathf.Sign(target - n); // must n be increased or decreased to get closer to target
		n += a * Time.deltaTime * dir;
		return (dir == Mathf.Sign(target-n))? n: target; // if n has now passed target then return target, otherwise return n
	}
}

}

Here’s the code for PlayerPhysics, if you need that:

using UnityEngine;
using System.Collections;

[RequireComponent (typeof(BoxCollider))]
public class PlayerPhysics : MonoBehaviour {

public LayerMask collisionMask;

private BoxCollider UnityEngine.Component.collider;
private Vector3 s;
private Vector3 c;

private float skin = .005f;

[HideInInspector]
public bool grounded;

Ray ray;
RaycastHit hit;

void Start() {
	collider = GetComponent<BoxCollider>();
	s = collider.size;
	c = collider.center;
}

public void Move(Vector2 moveAmount) {
	
	float deltaY = moveAmount.y;
	float deltaX = moveAmount.x;
	Vector2 p = transform.position;
	
	// Check collisions above and below
	grounded = false;
	
	for (int i = 0; i<3; i ++) {
		float dir = Mathf.Sign(deltaY);
		float x = (p.x + c.x - s.x/2) + s.x/2 * i; // Left, centre and then rightmost point of collider
		float y = p.y + c.y + s.y/2 * dir; // Bottom of collider
		
		ray = new Ray(new Vector2(x,y), new Vector2(0,dir));
		Debug.DrawRay(ray.origin,ray.direction);
		if (Physics.Raycast(ray,out hit,Mathf.Abs(deltaY),collisionMask)) {
			// Get Distance between player and ground
			float dst = Vector3.Distance (ray.origin, hit.point);
			
			// Stop player's downwards movement after coming within skin width of a collider
			if (dst > skin) {
				deltaY = dst * dir + skin;
			}
			else {
				deltaY = 0;
			}
			
			grounded = true;
			
			break;
			
		}
	}
	

	
	Vector2 finalTransform = new Vector2(deltaX,deltaY);
	
	transform.Translate(finalTransform);
}

}

Hope that helps. Help would be greatly appreciated!

In Start():

void Start () {
    PlayerPhysics = GetComponent<PlayerPhysics>();
}

PlayerPhysics is a type.

Change to:

void Start () {
    playerPhysics = GetComponent<PlayerPhysics>();
}

Now you are assigning a value to your variable.