HI I'm having a parsing error, it is used for a basic pong game This is what it is Assets/Scripts/Ball.cs(35,1): error CS8025: Parsing error Here is the script; usingUnityEngine; usingSystem.Collections; publicclassBall : MonoBehaviour { publicfloatballVolocity = 500; Rigidbodyrb; boolisPlay; intrandInt; voidAwake () { rb = gameObject.GetComponent<Rigidbody> (); randInt = Random.Range (1, 3); } voidUpdate () { if(Input.GetMouseButton(0) == true && isPlay == false) { Transform.parent = null; isPlay = true; rb.isKinematic = false; if(randInt == 1) { rb.AddForce(newVector3(ballVelocity,ballVelocity,0)); } if(randInt == 2) { rb.AddForce(newVector3(-ballVelocity,-ballVelocity,0)); } } }
at a guess it's this line Code (csharp): Transform.parent = null; you want lowercase t transform, else you're trying to access the Class, not the local transform. also http://forum.unity3d.com/threads/using-code-tags-properly.143875/ adds line numbers and makes the code you paste in more readable, so we'd know which was line 35 (from the error message...)
The parsing error was a missing closing curly brace. ballVelocity declaration is spelt incorrectly. Missing spaces in various places. Here is the corrected script. Code (CSharp): using UnityEngine; using System.Collections; public class Ball : MonoBehaviour { public float ballVelocity = 500; Rigidbody rb; bool isPlay; int randInt; void Awake () { rb = gameObject.GetComponent<Rigidbody> (); randInt = Random.Range (1, 3); } void Update () { if(Input.GetMouseButton(0) == true && isPlay == false) { transform.parent = null; isPlay = true; rb.isKinematic = false; if(randInt == 1) { rb.AddForce(new Vector3(ballVelocity,ballVelocity,0)); } if(randInt == 2) { rb.AddForce(new Vector3(-ballVelocity,-ballVelocity,0)); } } } }