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 kageoushou · Jan 01, 2014 at 07:17 PM · errorplatform

PlatformMover-Error BCE0044: expecting EOF, found '}'

Have been following this Unity tutorial on Youtube for a side scroller game and writing a script to make a platform move however i keep getting the error BCE0044: expecting EOF, found '}'. I've tried deleting every single "}" but more errors pop up Please Help

Here is the script

 #pragma strict
 
 function Start () {
 
 var Xpos : float;
 var Ypos : float;
 var max : boolean;
 }
 
 var Vert : boolean;
 var maxAmount : int;
 var step : float;
     Xpos = transform.position.x;
     ypos = transform.position.y;
 }
 
 function Update () {
 
     if(Vert){
         if(transform.position.y >= Ypos = maxAmount){
             max = true;
         } else if(transform.position.y <= ypos){
             max = false;
         }
     } else {
         if(transform.position.x >= Xpos = maxAmount){
             max = true;
         } else if(transform.position.x <= Xpos){
             max = false;
         }
     }
     
     if(Vert){
         if(!max){
             transform.position.y += step;
         } else {
             transform.position.y -= step;
         }
     } else {
         if(!max){
             transform.position.x += step;
         } else {
             transform.position.x -= step;
         }
     }
Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Jan 01, 2014 at 07:23 PM

You have a number of issues here. Part of the issues are matching braces. If you place your cursor at a '{' or a '}' in Monodevelop, the matching bracket will be highlighted. You have missing brackets and extra brackets. To start with, I believe the top of your file should be like this:

 #pragma strict
 
 var Xpos : float;
 var Ypos : float;
 var max : boolean;
 
 var Vert : boolean;
 var maxAmount : int;
 var step : float;
 
 function Start () {
     Xpos = transform.position.x;
     ypos = transform.position.y;
 }

Note how the declaration of the variables is outside the Start() function. If they were in the Start() function, they would be 'local' variables and go out of scope (no longer available) when Start() exited.

Then if you place your cursor on the '{' on line 15, you will see you are missing a closing bracket for the Update() function. Place a '}' at the end of the file.

Once these items are fixed, there are some additional problems. To start with line 20 and line 26 are not correct syntax. I'm not sure what you are trying to do maybe something like:

 if (transform.position.x >= Xpos && XPos <= maxAmount) {

Anyway if you are following a tutorial, take a close line-by-line look at the code to see how their syntax differs from yours.

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
avatar image
0

Answer by kageoushou · Jan 01, 2014 at 11:18 PM

http://www.youtube.com/watch?v=xxVkbT-qsCw

This is the tutorial I'm following apart from the beginning pretty sure I followed it line by line I moved the variables into the function start by random and it cleared up most of the errors except for that one above so I assumed that less errors the better

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
avatar image
0

Answer by kageoushou · Jan 01, 2014 at 11:18 PM

fixed it thanks for your help and sorry for being a complete noob but i put the variables under the function start in another script but that is working fine could you please explain what you meant by

how the declaration of the variables is outside the Start() function. If they were in the Start() function, they would be 'local' variables and go out of scope (no longer available) when Start() exited.

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

20 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 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

How to Fix Compilier Errors? 0 Answers

Moving platform with button 1 Answer

NullReferenceException: Object reference not set to an instance of an object. 2 Answers

Teleportation Problem 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