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 SugarSores · Aug 07, 2012 at 09:09 PM · startifbce0044elseeof

BCE0044 Error in the Start function

This is my first time posting a question, so forgive me if I place the code wrong or something. Now, my problem appears to be with the curly brackets. I have looked at numerous answers and forums, but no luck. I have tried many variations with my script, and it just wont work.

This is what the Console states " (15,9) BCE0044: expecting }, found 'else'" and "(20,1): BCE0044: expecting EOF, found '}'."

I'm sure you guys can figure this out easy! Thankyou for your help!

  function Start () 
     {
     
      //Check for right.
      if (dirStart >= 5)
      rightEnabled == true;
      leftEnabled == false;
      Right();
      //Check for left.
      else
      if (dirStart < 5)
      rightEnabled==false;
      leftEnabled ==true;
      Left();
     }
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by fafase · Aug 07, 2012 at 09:12 PM

Hey,

You must be starting programming :)

 function Start () 
 {
  //Check for right.
   if (dirStart >= 5){
     rightEnabled = true;
     leftEnabled = false;
     Right();
  }
  //Check for left.
   else if (dirStart < 5){
     rightEnabled=false;
     leftEnabled =true;
     Left(); 
   }
 }
Comment
Add comment · Show 5 · 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 SugarSores · Aug 07, 2012 at 10:48 PM 0
Share

Thanks for responding so fast, buuuuut I did this before and I got this "BCE0034: Expressions in statements must only be executed for their side-effects." Any ideas? Would you like to see the whole script?

avatar image fafase · Aug 08, 2012 at 07:57 AM 0
Share

Oh yes, you are comparing and not assigning in the conditions. That is what Unity is telling you. It tells you that in a condition (if statement), you need to perform an action that is changing something (side-effect). rightEnabled == true is comparing and not modifying anything.

Now what is your purpose, two possibilties,

  • you want to check if dirStart is greater than 5 AND rightEnabled is true AND leftEnabled is false, then you call Right()

  • you want to check only if dirStart is greater than 5, then rightEnabled is made true and leftEnabled is made false and also the function Right() is called

Depending what you want to do I will change the answer.

avatar image SugarSores · Aug 08, 2012 at 06:27 PM 0
Share

$$anonymous$$y purpose is the second option that you provided. Thanks again!

avatar image fafase · Aug 08, 2012 at 07:02 PM 0
Share

Done. = assigns the right value to the left value. == compare the left value with the right value and returns true or false.

avatar image fafase · Aug 08, 2012 at 08:55 PM 0
Share

I unfortunately cannot assume the position of a personal mentor. Furthermore, you can get dozens of mentors on this forum 24/7, and some of them are way better than me. Glad it helped though.

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

8 People are following this question.

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

Related Questions

Else and If 2 Answers

An EOF Problem :( 1 Answer

Help playing the right animation 1 Answer

Why am i getting this error?! 2 Answers

How to finish my else if statement? 2 Answers


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