Why is this not working?
I have been following the Unity Roll-A-Ball tutorial but now I am stuck and I keep getting this error.
Answer by jgodfrey · Jun 14, 2016 at 12:14 AM
The error is fairly self-explanatory. The file "PlayerControler.cs" has a syntax issue on line 29, column 40 (etc). Apparently, related to a "(" character.
Without code, I can't say much more...
@jgodfrey Ok I have managed to fix that. But now I am getting this. (Picture) Here is the code:
public class as PlayerController : $$anonymous$$onoBehaviour {
public float speed;
public Text countText;
public Text winText;
public Rigidbody rb;
public int count;
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText ();
winText.text = "";
}
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 ();
if (count >= 12)
{
winText.text = "You Win!";
}
}
If you posted all of that file, you're missing the final closing brace at the end. Though, I don't understand the line/column reference in the message in that case...
Your answer
![](https://koobas.hobune.stream/wayback/20220612082904im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
getting unexpected symbol ';' error 1 Answer
How to Move an Image to an other Panel 1 Answer
Best way to create a currency converter in Unity with C# 0 Answers
A way to make the player get punished when standing still? 0 Answers
Is there a way to run Destroy(gameObject) after the game has run the previous code? 1 Answer