"All compiler errors have to be fixed before you can enter playmode!"


I’m creating a game through a tutorial, I did all the steps right but when I go to run the game gives me error in the compiler.
I reviewed the code and are all equal.

Someone help me?
PS: Sorry for my english.

using UnityEngine;
using System.Collections;

public class PlayerControlo : MonoBehaviour {

	//Controlo Player
	public float speed = 8;
	public float acceleration = 12;

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

	private PlayerFisica playerFisica;

	// Use this for initialization
	void Start () {
		playerFisica = GetComponent.PlayerFisica();
	// Update is called once per frame
	void Update () {
		targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
		currentSpeed = IncrementTowards(currentSpeed, targetSpeed,acceleration);

		amountToMove = new Vector2(currentSpeed,0);
		playerFisica.Move(amountToMove * Time.deltaTime);

	private float IncrementTowards(float n, float target, float a){
		if (n == target) {
			return n;
		else {
			float dir = Mathf.Sign(target - n); 
			n += a * Time.deltaTime * dir;
			return (dir == Mathf.Sign(target-n))? n: target;

“All compiler errors have to be fixed before you can enter playmode!” is an error that occurs when your code cannot compile properly and you attempt to play anyways. Since this error message is caused by another error you should look at the original error. (if I see this message I usually hit clear since compile time errors will reappear in the debugger while runtime errors, such as this, will not).

The actual error is probably the line

playerFisica = GetComponent.PlayerFisica();

which needs to be

playerFisica = GetComponent<PlayerFisica>();

in order to compile.

As long as PlayerFisica is a monobehaviour that implements Move(Vector2) your code should now compile.


also make sure it is not null


if your script does not contain Move creates it , or maybe the name is wrong or you simply put private or protected your method .