• 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 Cowsheepo · Aug 31, 2013 at 11:07 PM · javascripterrorbeginner

Assets/Scripts/Cubemove.js(44,167): BCE0017: The best overload for the method 'UnityEngine.Mathf.Round(float)' is not compatible with the argument list '(boolean)'.

I don't know what this error is or what it's complaining about. Could someone please explain it? I'm very novice at Unity and javascript, but have some experience in other languages.

The full code is below: var power : int; var audioPlaying : boolean; function FixedUpdate () { if(Input.GetButton("Forward")) rigidbody.AddTorque(transform.forward * power);

     if(Input.GetButton("Backward"))
         rigidbody.AddTorque(-transform.forward * power);
         
     if(Input.GetButtonDown("Left"))
     {
     if(Mathf.Round(transform.eulerAngles.z)==0)
         transform.eulerAngles += Vector3(0,-90,0);
     if(Mathf.Round(transform.eulerAngles.z)==90)
         transform.eulerAngles += Vector3(0,-90,0);
     if(Mathf.Round(transform.eulerAngles.z)==180)
         transform.eulerAngles += Vector3(0,-90,0);
     if(Mathf.Round(transform.eulerAngles.z)==270)
         transform.eulerAngles += Vector3(0,-90,0);
     if(Mathf.Round(transform.eulerAngles.z)==360)
         transform.eulerAngles += Vector3(0,-90,0);
     }
         
     if(Input.GetButtonDown("Right"))
     {
     if(Mathf.Round(transform.eulerAngles.z)==0)
         transform.eulerAngles += Vector3(0,90,0);
     if(Mathf.Round(transform.eulerAngles.z)==90)
         transform.eulerAngles += Vector3(0,90,0);
     if(Mathf.Round(transform.eulerAngles.z)==180)
         transform.eulerAngles += Vector3(0,90,0);
     if(Mathf.Round(transform.eulerAngles.z)==270)
         transform.eulerAngles += Vector3(0,90,0);
     if(Mathf.Round(transform.eulerAngles.z)==360)
         transform.eulerAngles += Vector3(0,90,0);
     }
     
 transform.eulerAngles.y=Mathf.Round(transform.eulerAngles.y/90)*90;
 transform.eulerAngles.x=0;
 
     if(transform.position.y<0)
         Application.LoadLevel(""+PlayerPrefs.GetFloat("Level"));
         
     if(Mathf.Round(transform.eulerAngles.z/10)*10==0||Mathf.Round(transform.eulerAngles.z/10)*10==90||Mathf.Round(transform.eulerAngles.z/10)*10==180||Mathf.Round(transform.eulerAngles.z/10*10==270))
     {
         if(audioPlaying == 0)
         {
             audioPlaying = 1;
             audio.Play();
     }}
 
     if(Mathf.Round(transform.eulerAngles.z/5)*5==30||Mathf.Round(transform.eulerAngles.z/5)*5==60||Mathf.Round(transform.eulerAngles.z/5)*5==120||Mathf.Round(transform.eulerAngles.z/5)*5==150||Mathf.Round(transform.eulerAngles.z/5)*5==210||Mathf.Round(transform.eulerAngles.z/5)*5==240||Mathf.Round(transform.eulerAngles.z/5)*5==300||Mathf.Round(transform.eulerAngles.z/5)*5==330) {
         audioPlaying = 0;
     }
 }


I've probably done this horribly inneficiently too, so if you have any suggestions that'd be great

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 getyour411 · Aug 31, 2013 at 11:22 PM

You are missing a closing ) at the very end of line 38 as you have it posted here.

 This
 (transform.eulerAngles.z/10)*10==180||Mathf.Round(transform.eulerAngles.z/10*10==270))
 should be this
 (transform.eulerAngles.z/10)*10==180||Mathf.Round(transform.eulerAngles.z/10**)***10==270))
Comment
Add comment · Show 1 · 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 Cowsheepo · Aug 31, 2013 at 11:41 PM 0
Share

Thanks! That fixed it.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 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

Related Questions

How do I reset a variable? 2 Answers

Need Help Understanding Script! (Javascript) 1 Answer

Help with a simple following AI 1 Answer

OnMouseEnter Error 1 Answer

It is not possible to invoke an expression of type 'UnityEngine.GameObject'? 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