How to fix this parsing error?
What is wrong in this source code? How do I fix this parse error?
Error Message: Assets/Scripts/NumberWizard.cs(40,22): error CS8025: Parsing error
Source Code:
using UnityEngine; using System.Collections;
public class NumberWizard : MonoBehaviour {
// Use this for initialization
void Start ()
{
print ("Welcome to NumberWizard!");
print ("Pick a number in your head, but dont tell me.");
int maximum = 1000;
int minimum = 1;
print ("The highest number you can pick is" + maximum);
print ("The lowest number you can pick is" + minimum);
print ("Is the number higher or lower than 500?");
print ("Press UP for higher, DOWN for lower, and RETURN for equals to 500.");
}
// Update is called once per frame
void Update (){
if (Input.GetKeyDown(KeyCode.UpArrow))
{
print ("You pressed UP");
}
if (Input.GetKeyDown(KeyCode.DownArrow))
{
print ("You pressed DOWN");
}
}
Please format your code properly.
If there is an error, post the complete emessage.
Parsing errors are commonly occuring because you forget a "}" or ";" somewhere.
UPDATE:
The error message :
Assets/Scripts/NumberWizard.cs(40,22): error CS8025: Parsing error
UPDATE:
The error message :
Assets/Scripts/NumberWizard.cs(40,22): error CS8025: Parsing error
And do you have a closing } at the end of your script?
This is the entire Source Code, do feel free to edit it to show the error :
using UnityEngine; using System.Collections;
public class NumberWizard : $$anonymous$$onoBehaviour {
// Use this for initialization void Start () { print ("Welcome to NumberWizard!"); print ("Pick a number in your head, but dont tell me.");
int maximum = 1000; int $$anonymous$$imum = 1;
print ("The highest number you can pick is" + maximum); print ("The lowest number you can pick is" + $$anonymous$$imum);
print ("Is the number higher or lower than 500?"); print ("Press UP for higher, DOWN for lower, and RETURN for equals to 500.");
}
// Update is called once per frame void Update (){
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.UpArrow))
{
print ("You pressed UP");
}
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.DownArrow))
{
print ("You pressed DOWN");
}
}
This is the entire Source Code, do feel free to edit it to show the error :
using UnityEngine; using System.Collections;
public class NumberWizard : $$anonymous$$onoBehaviour {
// Use this for initialization
void Start ()
{
print ("Welcome to NumberWizard!");
print ("Pick a number in your head, but dont tell me.");
int maximum = 1000;
int $$anonymous$$imum = 1;
print ("The highest number you can pick is" + maximum);
print ("The lowest number you can pick is" + $$anonymous$$imum);
print ("Is the number higher or lower than 500?");
print ("Press UP for higher, DOWN for lower, and RETURN for equals to 500.");
}
// Update is called once per frame
void Update (){
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.UpArrow))
{
print ("You pressed UP");
}
if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.DownArrow))
{
print ("You pressed DOWN");
}
}
Answer by tanoshimi · May 08, 2016 at 05:42 PM
You're missing a closing } at the end of the script, which would be clear if you indented and formatted your code properly...
Oh! Thank you Tanoshimi! Helped a lot! That was a silly mistake. :< Thanks!