- Home /
Question by
HTN2001Memer · May 02, 2016 at 05:13 AM ·
error reporting
How do I fix the CS8025 Parsing Error in Unity 5
Here's the Script:
using UnityEngine; using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start() {
}
// Update is called once per frame void Update () {
private Rigidbody rb; {}
rb = GetComponent<Rigidbody>();
}
void FixedUpdate()
{ } float moveHorizontal = Input.GetAxis ("Horizontal");
}
float moveVertical = Input.GetAxis ("Vertical")
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical)
}
}
}
}
}
rb.AddForce (movement)
Comment
Please format your code properly.
Please include the full error message, including the line it occurs.
You are probably missing an ";" or "}" somewhere... As in, at least three (!) of your lines:
float moveVertical = Input.GetAxis ("Vertical") //missing ";" Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical) //missing ";" rb.AddForce (movement) //missing ";"
Answer by Xitech_ · May 02, 2016 at 12:13 PM
You are missing a ";" almost at every line, and you have way to many closing brackles.
Here is the correct format:
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement);
}
Your answer
