Error CS1519 and Error CS8025
This is my first time ever coding, and it's for the Roll-a-Ball tutorial, and I'm kind of stuck because I don't think I can remove any of the symbols it's telling me to remove.
Here are the error codes:
Assets/Scripts/PlayerController.cs(40,5): error CS1519: Unexpected symbol {' in class, struct, or interface member declaration Assets/Scripts/PlayerController.cs(41,24): error CS1519: Unexpected symbol
=' in class, struct, or interface member declaration
Assets/Scripts/PlayerController.cs(41,53): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/Scripts/PlayerController.cs(43,1): error CS8025: Parsing error
Here's the script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
private Rigidbody rb;
private int count;
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText ();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Pick Up"))
{
other.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ();
{
countText.text = "Count: " + count.ToString ();
}
}
Answer by Ali-hatem · Mar 30, 2016 at 09:19 AM
void SetCountText () // delete the semicolon
Thank you so much, that was really simple but I appreciate it a lot.
next time double click the error message in unity will take you to the line where the error is.
Your answer
