What's wrong with my code?

I’ve just started learning to code and use unity so forgive me if the answer is obvious. Unity is saying that there is a parsing error and I have no idea where it is.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Playercontroller : MonoBehaviour
{

public float speed =800.0f;
public Text Score;
public Text Victory;
private int count = 0;

void Start()
{
count = 0;
}

void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);

Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

GetComponent().AddForce (movement * speed *Time.deltaTime);
}

void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == “Pickøpp”);

other.gameObject.SetActive (false);
count += 1;
Score.text = "Score: " + count;
if (count>= 16)
{
Victory.gameObject.SetActive(true);
}
}

Two issues:
You’re missing a closing brace at the end of the file so add an } at the bottom line.

You have a semi-colon after your if(other.gameObject.tag == “Pickøpp”); which I’m guessing isn’t intentional.

For future reference: Parse errors almost always mean you’re missing an opening or closing brace.

2 Likes

Thank you, everything works now.

One more thing though.
My win text does not pop up.

other.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
}
}

void SetCountText ()
{
Score.text = "Count: " + count.ToString ();
if (count == 11);
{
Victory.text = “Good Job!”;
}
}
}

Are you setting the gameobject to active? (like in the first script?)

Victory.gameObject.SetActive(true);

I was trying to activate the Win text.