- Home /
"Expecting ), found ';'" and "';' expected. Insert a semicolon at the end"
I am trying to make a pretty simple script where the player clicks on a wall and it disappears. I'm doing this by making a crumbling sound effect play and the wall object transform to 0, 0, 0, which is outside the game area so the player won't see it. I don't want to destroy the game object because I need it to return later. That's another script and unrelated to the problem. The problem is no matter what I do, I get five or six error messages after I save, all saying either "BCE0044: expecting ), found ';'.", or "UCE0001: ';' expected. Insert a semicolon at the end." I have pored over it looking for open brackets or missing semicolons and I can't figure out what's wrong. Here is the code: #pragma strict var beep : AudioClip;
function OnMouseUp(){
(audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
)
(GameObject.transform.position(0,0,0);
)
}
@script RequireComponent(AudioSource)
What am I doing wrong in this?
I just noticed that "#pragma srict var beep : AudioClip;" is outside the code sampler lol. That's supposed to be part of the code.
Also, when I get rid of the brackets around the audio and transform functions, because I know people will say that, it gives me this: BCE0020: An instance of type 'UnityEngine.GameObject' is required to access non static member 'transform'. I know I haven't capitalized 'transform', and I have tried inserting Vector3 in front of the position values. What else should I change?
gameObject.transform... (lower case) and get rid of those brackets you will not get the BCE0020 error
function On$$anonymous$$ouseUp() {
audio.PlayOneShot(beep);
yield WaitForSeconds(audio.clip.length + 0.01);
transform.position = Vector3.zero;
}
@script RequireComponent(AudioSource)
Answer by CostelloNicho · Nov 12, 2012 at 08:54 PM
You wrote GameObject.transform...(upper case)
you needed
gameObject.transform.. (lower-case)
So remove the the brackets you mentioned in comment2