Search Unity

Parsing Error8025 driving me crazy.

Discussion in 'Scripting' started by Kudaaj, Mar 27, 2015.

  1. Kudaaj

    Kudaaj

    Joined:
    Mar 25, 2015
    Posts:
    6
    I've looked through my script multiple times and I've got the parsing error cs8025 sitting in my error log, it's starting to frustrate me due to being a noob, I've watched tutorials and read guides and found its simply a } error, it says on line 182 (Final line) Here is my script


    using UnityEngine;
    using System.Collections;
    public class FighterAnimationDemo : MonoBehaviour {
    private bool crouchBool = false;
    private bool dead = false;
    private bool InAir = false;
    public Animator animator;
    public Transform defaultCamTransform;
    public float defaultSpeed = 12f;
    private Vector3 resetPos;
    private Quaternion resetRot;
    private GameObject cam;
    public GameObject fighter;
    void Start()
    {
    cam = GameObject.FindWithTag("MainCamera");
    defaultCamTransform = cam.transform;
    resetPos = defaultCamTransform.position;
    resetRot = defaultCamTransform.rotation;
    fighter = GameObject.FindWithTag("Player");
    }
    IEnumerator COInAir(float toAnimWindow)
    {
    yield return new WaitForSeconds(toAnimWindow);
    InAir = true;
    animator.SetBool("InAir", true);
    yield return new WaitForSeconds(0.5f);
    InAir = false;
    animator.SetBool("InAir", false);
    }
    void OnGUI ()
    {
    {
    defaultCamTransform.position = resetPos;
    defaultCamTransform.rotation = resetRot;
    fighter.transform.position = new Vector3(0,0,0);
    animator.Play("Idle");
    }
    {
    }
    if (GUI.Button (new Rect (245, 20, 100, 30), "Intro1"))
    {
    animator.SetTrigger("Intro1Trigger");
    }
    if (GUI.Button (new Rect (345, 20, 100, 30), "Victory1"))
    {
    animator.SetTrigger("Victory1Trigger");
    }
    if (GUI.Button (new Rect (245, 50, 100, 30), "Intro2"))
    {
    animator.SetTrigger("Intro2Trigger");
    }
    if (GUI.Button (new Rect (345, 50, 100, 30), "Victory2"))
    {
    animator.SetTrigger("Victory2Trigger");
    }
    if (GUI.Button (new Rect (25, 90, 100, 30), "Uppercut"))
    {
    animator.SetTrigger("UppercutTrigger");
    }
    if (GUI.Button (new Rect (25, 120, 100, 30), "Punch"))
    {
    animator.SetTrigger("PunchTrigger");
    }
    if (GUI.Button (new Rect (25, 150, 100, 30), "Jab"))
    {
    animator.SetTrigger("JabTrigger");
    }
    if (GUI.Button (new Rect (25, 180, 100, 30), "Kick"))
    {
    animator.SetTrigger("KickTrigger");
    }
    {
    crouchBool = GUI.Toggle (new Rect (140, 215, 100, 30), crouchBool, "Crouch");
    if (crouchBool)
    animator.SetBool("Crouch", true);
    else
    animator.SetBool("Crouch", false);
    }
    if(!crouchBool)
    {
    }
    if (crouchBool)
    {
    if (GUI.Button (new Rect (135, 300, 100, 30), "Low Kick") && crouchBool)
    {
    animator.SetTrigger("LowKickTrigger");
    }
    if (GUI.Button (new Rect (135, 240, 100, 30), "Sweep") && crouchBool)
    {
    animator.SetTrigger("SweepTrigger");
    }
    if (GUI.Button (new Rect (135, 270, 100, 30), "Low Punch"))
    {
    animator.SetTrigger("LowPunchTrigger");
    }
    }
    {
    if (GUI.Button (new Rect (30, 340, 100, 30), "Jump"))
    {
    animator.SetTrigger("JumpTrigger");
    StartCoroutine (COInAir(0.25f));
    }
    }
    if (InAir)
    {
    if (GUI.Button (new Rect (135, 370, 100, 30), "Jump Punch") && InAir)
    {
    animator.SetTrigger("HighPunchTrigger");
    }
    if (GUI.Button (new Rect (135, 340, 100, 30), "Jump Hit React") && InAir)
    {
    animator.SetTrigger("JumpHitReactTrigger");
    }
    if (GUI.Button (new Rect (135, 400, 100, 30), "Jump Kick") && InAir)
    {
    animator.SetTrigger("HighKickTrigger");
    }
    }
    if (GUI.Button (new Rect (30, 400, 100, 30), "Jump Backward"))
    {
    animator.SetTrigger("JumpBackwardTrigger");
    StartCoroutine (COInAir(0.25f));
    }
    if (GUI.Button (new Rect (30, 440, 100, 30), "RangeAttack1"))
    {
    animator.SetTrigger("RangeAttack1Trigger");
    }
    if (GUI.Button (new Rect (135, 440, 100, 30), "RangeAttack2"))
    {
    animator.SetTrigger("RangeAttack2Trigger");
    }
    if (GUI.Button (new Rect (30, 470, 100, 30), "MoveAttack1"))
    {
    animator.SetTrigger("MoveAttack1Trigger");
    }
    if (GUI.Button (new Rect (135, 470, 100, 30), "MoveAttack2"))
    {
    animator.SetTrigger("MoveAttack2Trigger");
    }
    if (GUI.Button (new Rect (30, 500, 100, 30), "SpecialAttack1"))
    {
    animator.SetTrigger("SpecialAttack1Trigger");
    }
    if (GUI.Button (new Rect (135, 500, 100, 30), "SpecialAttack2"))
    {
    animator.SetTrigger("SpecialAttack2Trigger");
    }
    }
     
  2. Antistone

    Antistone

    Joined:
    Feb 22, 2014
    Posts:
    2,836
    Please use code tags.

    If the compiler tells you that it expected a } on line X, that really just means you have mismatched {} braces somewhere on or before line X. Line X was just the earliest that the compiler could be 100% sure that it was never going to find a proper match (which is why it's usually at the end of the file).

    In many code editors, if you click on a curly brace, it will highlight the "matching" curly brace. That can help you figure out where your mistake is.

    Many code editors also have a command to automatically indent your code based on the braces; that will sometimes help you spot your error when the indentation changes (or fails to change) unexpectedly.

    My guess is that the left brace { right before the line that says "if (GUI.Button (new Rect (30, 340, 100, 30), "Jump"))" is supposed to be a right brace }. But it's really hard to tell with a giant block of code with no indentation, especially when you seem to be inserting braces in some places that don't need them and randomly leaving them out of other places where it would make sense to have them.
     
    Kiwasi likes this.
  3. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    @Antistone has it right.

    Parsing errors become incredibly easy to spot if you maintain proper indentation throughout your code.
     
  4. Kudaaj

    Kudaaj

    Joined:
    Mar 25, 2015
    Posts:
    6
    I managed to find it, thanks a lot :)