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 Dok101 · Dec 18, 2013 at 05:38 PM · cameragui

BCE0023: No appropriate version of 'UnityEngine.GUI.Button' for the argument list '(UnityEngine.Rect, int)' was found.

I am trying to switch camera when a button is pressed Here is my code

 var Main_Camera : Camera; 
 var Main_Camera_2 : Camera; 
 var Main_Camera_3 : Camera; 
 var Main_Camera_4 : Camera; 
 var Main_Camera_5 : Camera; 
 
 public var CameraView = 1; 
 public var Speed = 0;
 var updateInterval = 1.0;
 private var accum = 0.0; // FPS accumulated over the interval
 private var frames = 0; // Frames drawn over the interval
 private var timeleft : float; // Left time for current interval
 private var fps = 15.0; // Current FPS
 private var lastSample : double;
 private var gotIntervals = 0;
 
 function Start()
 {
  }
  
 function Update()
 {
 Speed = rigidbody.velocity.magnitude * 2.237;
 }
 
 function OnGUI()
 {
     GUI.Box(new Rect(Screen.width-160, 10, 150, 27), "Speed : " + Speed + ": MPH");
     
         if (GUI.Button(Rect(20,35,50,30), CameraView))    
     if(CameraView < 5) CameraView++;
     else CameraView = 1;
 }
  
 if( CameraView == 1){
     Main_Camera.enabled = true;
     Main_Camera_2.enabled = false;
     Main_Camera_3.enabled = false;
     Main_Camera_4.enabled = false;
     Main_Camera_5.enabled = false;
 } 
 else if ( CameraView == 2) {
     Main_Camera.enabled = false;
     Main_Camera_2.enabled = true;
     Main_Camera_3.enabled = false;
     Main_Camera_4.enabled = false;
     Main_Camera_5.enabled = false;
 } 
 else if ( CameraView == 3){
     Main_Camera.enabled = false;
     Main_Camera_2.enabled = false;
     Main_Camera_3.enabled = true;
     Main_Camera_4.enabled = false;
     Main_Camera_5.enabled = false;
 } 
 else if ( CameraView == 4){
     Main_Camera.enabled = false;
     Main_Camera_2.enabled = false;
     Main_Camera_3.enabled = false;
     Main_Camera_4.enabled = true;
     Main_Camera_5.enabled = false;
 } 
 else if ( CameraView == 5){
     Main_Camera.enabled = false;
     Main_Camera_2.enabled = false;
     Main_Camera_3.enabled = false;
     Main_Camera_4.enabled = false;
     Main_Camera_5.enabled = true;
 }

(dont mind some of the variables theyre there for something else)

I have attached the cameras and everything and it should working but when I try to get the button to display Camera View variable I get "BCE0023: No appropriate version of 'UnityEngine.GUI.Button' for the argument list '(UnityEngine.Rect, int)' was found."

Its probably something simple but if anyone knows what the problem is please answer Thank you

Comment
Add comment · Show 6
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 flaviusxvii · Dec 18, 2013 at 05:41 PM 0
Share

I highly recommend always na$$anonymous$$g variables with camelCase, and classes/types with PascalCase.

avatar image robertbu · Dec 18, 2013 at 05:42 PM 0
Share
 if (GUI.Button(Rect(20,35,50,30), CameraView.ToString()))  

  
avatar image flaviusxvii · Dec 18, 2013 at 05:43 PM 0
Share

Hand out them fish @robertbu.

avatar image Dok101 · Dec 18, 2013 at 05:51 PM 0
Share

Thank you Robertbu that fixed it

avatar image flaviusxvii · Dec 18, 2013 at 07:47 PM 0
Share

You understand what that error message means now?

Show more comments

1 Reply

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

Answer by flaviusxvii · Dec 18, 2013 at 05:40 PM

http://docs.unity3d.com/Documentation/ScriptReference/GUI.Button.html

The error message is telling you that there is no version of Button that takes a Rect and an int. See the link for a list of allowed arguments.

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

18 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

Related Questions

How To Make A Floating Health Bar 1 Answer

picture in picture 3d. 0 Answers

Runescape style window? 1 Answer

Gui object to mouse position 1 Answer

GameObject GUI Script Drawing to a Specific Camera 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