- Home /
CS8025 Parsing Error
I'm getting CS8025 Parsing Error in line (39,9)
using UnityEngine; using System.Collections;
public class PlayerBehaviour : MonoBehaviour {
public Transform mesh; public float
forceFly; private Animator animatorPlayer;
private float currentTimeToAnim;
private bool inAnim;
// Use this for initialization void
Start () { animatorPlayer = mesh.GetComponent (); } > // Update is called once per frame > void Update () { > > if(Input.GetMouseButtonDown(0)){ > inAnim = true; } > > if(inAnim){ currentTimeToAnim += > Time.deltaTime; > > if(currentTimeToAnim > 0.4f){ > currentTimetoAnim = 0; > inAnim = false; > > } > } > > animatorPlayer.setBool("callFly", > inAnim); > > }
Answer by robertbu · Feb 15, 2014 at 03:57 PM
Parsing errors are usually an issue with bracketing. In Monodevelop, you can place your cursor at an opening bracket '{' and it will find the matching closing bracket. In your case you close off the Start() function early, which leaves a bunch of code outside of a function but inside of the class. There are a few other problems in this code...some may be a result of how you pasted this code into UA. You want to use the 101/010 button, not the quote button.
using UnityEngine;
using System.Collections;
public class PlayerBehaviour : MonoBehaviour {
public Transform mesh;
public float forceFly;
private Animator animatorPlayer;
private float currentTimeToAnim;
private bool inAnim;
void Start () {
animatorPlayer = mesh.GetComponent<Animator>(); // Update is called once per frame void Update () {
if(Input.GetMouseButtonDown(0)) {
inAnim = true;
}
if(inAnim){
currentTimeToAnim += Time.deltaTime;
if(currentTimeToAnim > 0.4f) {
currentTimeToAnim = 0;
inAnim = false;
}
}
animatorPlayer.SetBool("callFly", inAnim);
}
}