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 Dan 58462 · Nov 03, 2012 at 10:03 PM · errorconsolebce0044expecting

What is wrong with these two lines of scripting?

Here is one line: var PlayerScript : Player ANIMATION;

Player ANIMATION is the name of my other script and I am getting the console error:

Assets/GunScript.js(2,26): UCE0001: ';' expected. Insert a semicolon at the end.

I got rid of it by changing the script to:

var PlayerScript : PlayerAnimation;

I would like to know if this line of script should work fine? (Sorry for being vague with details)

Secondly, I have this error:

Assets/GunScript.js(111,1): BCE0044: expecting }, found ''.

For this line of script on the same script;

FireTimer -= Time.deltatime * FireRate;

I am just following a tutorial so I am not sure why not and I am a newbie to Unity. I f you would like the whole script posted, I will but it is over 100 lines(gaps included).

Sorry if it should be two questions.

EDIT: Just noticed that when i cut that line of script the error was still there?

Thanks!

Comment
Add comment · Show 3
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 Dan 58462 · Nov 05, 2012 at 06:56 PM 0
Share

var PlayerTransform : Transform; var PlayerScript : PlayerANI$$anonymous$$ATION; var RotationSpeed : float; var PlayerCamera : GameObject;

//Targets

@HideInInspector var TargetXrotation : float;

@HideInInspector var TargetYrotation : float;

@HideInInspector var TargetXrotationV : float;

@HideInInspector var TargetYrotationV : float;

//Gun Specs var $$anonymous$$axClipSize : float = 32; var AmmoInCurrentClip : float = 32; var ExtraAmmo : float = 128; var $$anonymous$$axCarryingAmmo : float = 256;

//Bullets and N/A var Bullet : GameObject; var BulletSpawn : GameObject; var BulletSound : GameObject; var FireRate : float; var FireTimer : float;

//Reloads var ReloadAnimation : Animation; var ReloadSound : AudioSource; var Reloading : boolean = false;

function LateUpdate () {

if (ExtraAmmo < $$anonymous$$axCarryingAmmo)

ExtraAmmo = $$anonymous$$axCarryingAmmo;

if ($$anonymous$$axClipSize < 0)

$$anonymous$$axClipSize = 0;

if (AmmoInCurrentClip > $$anonymous$$axClipSize)

AmmoInCurrentClip = $$anonymous$$axClipSize;

if (AmmoInCurrentClip < 0)

AmmoInCurrentClip = 0;

if (!Reloading && AmmoInCurrentClip == 0 && ExtraAmmo > 0 && Input.GetButtonDown("Fire 1")) { Reloading = true; ReloadSound.Play(); ReloadAnimation.PlayAnimation("ReloadAnim"); } if (!Reloading && AmmoInCurrentClip < $$anonymous$$axClipSize && ExtraAmmo > 0 && Input.GetButtonDown("Reload")) { Reloading = true; ReloadSound.Play; ReloadAnimation.PlayAnimation("ReloadAnim"); } if (Reloading == true && !ReloadAnimation.IsPlaying("ReloadAnim")) { if (ExtraAmmo >= $$anonymous$$axClipSize - AmmoInCurrentClip) { ExtraAmmo -= $$anonymous$$axClipSize - AmmoInCurrentClip; AmmoInCurrentClip = $$anonymous$$axClipSize; }

if (ExtraAmmo < $$anonymous$$axClipSize - AmmoInCurrentClip) { AmmoInCurrentClip += ExtraAmmo; ExtraAmmo = 0; } Reloading = false; }

var $$anonymous$$yBulletSound : GameObject;

if (Input.GetButtonDown("Fire 1") && $$anonymous$$axClipSize > 0 && !Reloading) {

if (FireTimer <= 0) { $$anonymous$$axClipSize -= 1;

if (Bullet)

Instantiate (Bullet,BulletSpawn.transform.position,BulletSpawn.transform.rotation);

if (BulletSound)

$$anonymous$$yBulletSound = Instantiate (BulletSound,BulletSpawn.transform.position,BulletSpawn.transform.rotation);

FireTimer = 1;

}

}

FireTimer -= Time.deltaTime * FireRate;

That's all of my scripts but I haven't bothered to but the gaps back in where they have disappeared when copied into the comment. JesseScope, if you could tell me where the other bracket/scope errors are I would be very grateful.

Is there a way of posting scripts with all of the appropriate gaps on unity answers?

avatar image Dan 58462 · Nov 10, 2012 at 05:50 PM 0
Share

Anyone, please?

avatar image fafase · Nov 10, 2012 at 08:39 PM 0
Share

In the first case, your problem was that space. When you name a component with upper case in the middle (called camelNa$$anonymous$$g) Unity automatically shows in the inspector as camel Na$$anonymous$$g. But you still need to use camelNa$$anonymous$$g in your script. For the second issue, Unity tells you line 111 because for some reason the last line is out of any scope. $$anonymous$$eaning it is not in any {} so Unity tells you nicely "The hell am I supposed to do with that??!!" You probably need to put it one line above as you have the matching amount of {}.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Jessespike · Nov 03, 2012 at 10:20 PM

The first problem is that you can't have spaces in object names.

Second problem is you need a capital T in deltaTime

Third problem is there are still more things wrong with your script but I can't see the code. Looks like you need to double check your braces/scopes { }

Comment
Add comment · Show 2 · 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
avatar image Dan 58462 · Nov 05, 2012 at 06:51 PM 0
Share

Thanks, I'll have a look but I think it's mainly deltaTime, on the tutorial they didnt have caps T though and theirs worked. If your ideas work I'll choose it as best answer :D

EDIT; Wait there is a Cps T in the scripts already, huh

avatar image fafase · Nov 05, 2012 at 07:27 PM 0
Share

What tutorial is that??!!deltaTime is a variable from the Time class, it always takes the T. or they use their own...

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

BCE0044: expecting error 1 Answer

What is Wrong With This Script? 3 Answers

Keep KGetting this error please help I dont know what to do 1 Answer

BCE0044: expecting '"', found '\r'. 1 Answer

Basic on collision play animation code not working 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