Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by PsychoticBob · Nov 12, 2012 at 08:23 PM · javascripterror

"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?

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image PsychoticBob · Nov 12, 2012 at 08:22 PM 0
Share

I just noticed that "#pragma srict var beep : AudioClip;" is outside the code sampler lol. That's supposed to be part of the code.

avatar image PsychoticBob · Nov 12, 2012 at 08:40 PM 0
Share

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?

avatar image CostelloNicho · Nov 12, 2012 at 08:43 PM 0
Share

gameObject.transform... (lower case) and get rid of those brackets you will not get the BCE0020 error

avatar image loihb · Nov 12, 2012 at 08:48 PM 1
Share
 function On$$anonymous$$ouseUp() {
     audio.PlayOneShot(beep);
     yield WaitForSeconds(audio.clip.length + 0.01);
     transform.position = Vector3.zero;
 }
 @script RequireComponent(AudioSource)
avatar image PsychoticBob · Nov 13, 2012 at 10:15 PM 0
Share

Ahh, that works now. Thank you very much

1 Reply

· Add your reply
  • Sort: 
avatar image
1

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

No appropriate version of 'UnityEngine.Object.Instantiate. Please Help :( 1 Answer

Need Help Understanding Script! (Javascript) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges