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
-1
Question by jmaster2012 · Feb 17, 2013 at 02:32 AM · javascripterrormultiplayerbce0022

HELP PLEASE

Getting MANY Errors!!! Here they are! BCE0022: Cannot convert 'int' to 'System.Type'. The type 'UnityEngine.Rect' does not have a visible constructor that matches the argument list '(float, System.Type, int, int)'. BCE0051: Operator '-' cannot be used with a left hand side of type 'System.Type' and a right hand side of type 'int'.BCE0051: Operator '+' cannot be used with a left hand side of type 'System.Type' and a right hand side of type 'int'. Here is my code.

 #pragma strict
 
 var RedPlayer : GameObject;
 var BluePlayer : GameObject;
 
 var CurTeam : String = "";
 
 var SpawnPointRed : GameObject;
 var SpawnPointBlue : GameObject;
 
 var CenterW : float;
 var CenterH = float;
 
 function Start ()
 {
     CurTeam = "";
     CenterW = Screen.width / 2 - 150;
     CenterH = Screen.height / 2 - 80;
 }
 function OnGUI () 
 {
     GUI.Box(Rect(CenterW, CenterH, 300, 160), "Select a Team");
     if(CurTeam == "")
     {    
         if(GUI.Button(Rect(CenterW + 5, CenterH - 20, 290, 65),"Red Team"))
     {
         
     }
     if(GUI.Button(Rect(CenterW + 5, CenterH + 120, 290, 65),"Blue Team"))
     {
         
     }
     }
     else
     {
         if(GUI.Button(Rect(CenterW + 5, CenterH + 20, 290, 130),"Respawn"))    
         {
         
         }
         
         }
 
 }
Comment
Add comment · Show 4
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 · Feb 17, 2013 at 03:15 AM 0
Share

STOP TAGGING POSTS WITH "JAVA". It's javascript. JAVASCRIPT. I repeat JAVASCRIPT!

avatar image youngapprentice · Feb 17, 2013 at 03:22 AM 1
Share

Also, it is better to refer to it as UnityScript. It isn't even Javascript. Also, please be more respectful and think of a better title than 'HELP PLEASE'. This is frowned upon as it doesn't help anyone figure out what might be in your question, aside from it being obnoxious. Oh and welcome to Unity Answers ;)

avatar image Bunny83 · Feb 17, 2013 at 03:27 AM 1
Share

Usually we are not that pedantic about that, but since Java is something completely different from JavaScript or UnityScript it does matter. Especially if you develop for Android you can use real Java classes, that's why it's important to distinguish Java from JavaScript.

avatar image adrennalinpro · Nov 19, 2013 at 07:29 AM 0
Share

It's referring to the line starting at number 14. I haven't figured out what it means, but I do know that line 14 is causing it (that entire function). Apparently using the screen's dimentions is counted as a float. $$anonymous$$y code is "childsPlay.guiTexture.pixelInset = Rect((Screen.width * -0.39), (Screen.height - Screen.height / 0.75));" and is recieving a similar error. childsPlay is a texture that I'm trying to place on the screen with support for different types of screens. Otherwise, the textures will float off. I've already used this method for GUITexts, and no problem. But when I try to use the methods for images, it gets reeeal sketchy.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Feb 17, 2013 at 02:32 AM

Instead of:

 var CenterH = float;

you need:

 var CenterH : float;
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

13 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

Related Questions

Javascript Snakegame Error Cannot convert ....Gameobject to .....Transform 1 Answer

BCE0043: Unexpected token: }. 1 Answer

Uploading webgl version of the game error 1 Answer

JScript problem 1 Answer

Weird error every frame 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