- Home /
Parsing error CS8025
Need to add a script so that a character in my project talks when a user clicks on it. Unity is saying I have a parsing error CS8025. here is my script
using UnityEngine; using System.Collections;
public class HannahVoice : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
var papers : int = 0; var papersToWin = 5; var distanceToPaper : float = 2.5; public var paperPickup : AudioClip;
function Start () {
Screen.lockCursor = true;
}
function Update () { if(Input.GetMouseButtonDown (0) || Input.GetKeyDown (KeyCode.E)) { var ray = Camera.main.ScreenPointToRay(Vector3(Screen.width 0.5, Screen.height 0.5, 0.0)); var hit : RaycastHit;
if(Physics.Raycast(ray, hit, distanceToPaper))
{
if(hit.collider.gameObject.name == “Casual_08___Stand”)
{
papers += 1;
GetComponent.<AudioSource>().PlayClipAtPoint(paperPickup, transform.position);
}
}
}
}
I am very new to this, any help is vastly appreciated
Everything until var papers:int
is ok. Until that line you use C# and from that line on you are using javascript. You can't mix the two languages in one class. Also in c# all the code must be inside the class' curly brackets, so even if you had only used c#, you would need to move all the code inside your outmost curlies
using UnityEngine;
public class HannahVoice : $$anonymous$$onoBehaviour {
//your code
}
Your answer
Follow this Question
Related Questions
CS8025 ERROR : Camera Script 1 Answer
unity 3d - c# scripting problems 1 Answer
Errors CS1525 and CS8025.... 1 Answer
Parsing Error: 1 Answer
Parsing Error I dont understand. 1 Answer