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();
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 ();
}
}
↧