Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity ERROR BCE0023 .JS

Discussion in 'Editor & General Support' started by EdgarCarrera, Jun 11, 2014.

  1. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255
    Can you help me with this error?

    Assets/Scripts/networking.js(66,62): BCE0023: No appropriate version of 'UnityEngine.GUI.BeginScrollView' for the argument list '(UnityEngine.Rect, String, UnityEngine.Rect)' was found.

    CODE: FULL

    Code (JavaScript):
    1. @script ExecuteInEditMode()
    2.  
    3. var gameName : String = "Mattsgamesfortesting";
    4.  
    5. var refreshing = false;
    6. var hostData : HostData[];
    7.  
    8. var create = false;
    9. var joining = false;
    10.  
    11. var serverName = "";
    12. var serverInfo = "";
    13. var serverPass = "";
    14.  
    15. var playerName = "";
    16.  
    17. var clientPass = "";
    18.  
    19. var scrollPosition = "";
    20.  
    21. function Start(){
    22.  
    23.     playerName = PlayerPrefs.GetString("Player Name");
    24. }
    25.  
    26. function OnGUI(){
    27.  
    28.     if(!Network.isClient && !Network.isServer){
    29.  
    30.         if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/2,100,20),"Create Game")){
    31.  
    32.             create = true;
    33.         }
    34.  
    35.         if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/2 + 30,100,20),"Create Game")){
    36.  
    37.             joining = true;
    38.             refreshHostList();
    39.         }
    40.     }
    41.  
    42. if(create){
    43.  
    44.     if(GUI.Button(Rect(Screen.wigth/2 - 50,Screen.height/3 + 110,100,50),"Create")){
    45.  
    46.         startServer();
    47.     }
    48.  
    49.     GUI.Label(Rect(Screen.width/2 - 110,Screen.height/3,100,20),"Server Name:");
    50.     GUI.Label(Rect(Screen.width/2 + 40,Screen.height/3,100,20),"Password:");
    51.     GUI.Label(Rect(Screen.width/2 - 30,Screen.height/3 + 90,100,20),"Server Info:");
    52.  
    53.     serverName = GUI.TextField (Rect(Screen.width/2 - 120,Screen.height/3 + 30, 100, 20),serverName, 12);
    54.     serverPass = GUI.PasswordField (Rect(Screen.width/2 + 20,Screen.height/3 + 30, 100, 20),serverPass, "*"[0], 12);
    55.     serverInfo = GUI.TextField (Rect(Screen.width/2 - 70,Screen.height/3 + 30, 150, 20),serverInfo, 12);
    56.  
    57.     if(GUI.Button(Rect(Screen.width/1.2,Screen.height/20,100,20),"Back")){
    58.  
    59.         create = false;
    60.     }
    61.  
    62.     if(joining){
    63.  
    64.         if(hostData){
    65.  
    66.             scrollPosition = GUI.BeginScrollView (Rect(Screen.width/4,Screen.height/6,Screen.width/1.5,Screen.height/2),scrollPosition, Rect(0, 0, 300, 1000/*hostData.Length * 30*/));
    67.             GUI.Label(Rect(30,0,100,20),"Game Name");
    68.             GUI.Label(Rect(350,0,100,20),"Server Info");
    69.             GUI.Label(Rect(590,0,100,20),"Player Count");
    70.             GUI.Label(Rect(700,0,100,20),"Password");
    71.  
    72.             for (var i:int = 0; i < hostData.length; i++){
    73.  
    74.                 GUI.Label(Rect(0,30 + i * 30,200,22),hostData[i].gameName);
    75.                 GUI.Label(Rect(160,30 + i * 30,500,22),hostData[i].comment);
    76.                 GUI.Label(Rect(640,30 + i * 30,100,22),hostData[i].connectedPlayers + " / " + hostData[i].playerLimit);
    77.  
    78.                 if(hostData[i].passwordProtected){
    79.  
    80.                     clientPass = GUI.PasswordField(Rect(680, 30 + i * 30, 100, 25), clientPass, "*"[0], 12);
    81.                 }
    82.  
    83.                 if(GUI.Button(Rect(800, 30 + i * 30, 100, 25), "Join")){
    84.                    
    85.                     Network.Connect(hostData[i], clientPass);
    86.                 }
    87.             }
    88.             GUI.EndScrollView();
    89.         }
    90.  
    91.         if(!hostData){
    92.  
    93.             GUI.Label(Rect(Screen.width/2 - 50,Screen.height/3,200,25), "No Games Found");
    94.  
    95.             if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/3 + 30,105,25),"Refresh")){
    96.                 refreshHostList();
    97.             }
    98.         }
    99.        
    100.         if(GUI.Button(Rect(Screen.width/1.2,Screen.height/20,100,20),"Back")){
    101.  
    102.             joining = false;
    103.         }
    104.     }
    105.  
    106.         if(GUI.Button(Rect(Screen.width/20,Screen.height/20,100,20),"Quit")){
    107.  
    108.             Application.Quit();
    109.         }
    110.  
    111.         GUI.Label(Rect(Screen.width/2 - 35,Screen.height/1.2 - 30,100,20),"Your Name:");
    112.         playerName = GUI.TextField(Rect(Screen.width/2 - 50,Screen.height/1.2,100,20), playerName, 12);
    113.         }
    114.     }
    115.  
    116.     function Update (){
    117.  
    118.         if(refreshing){
    119.  
    120.             if(MasterServer.PollHostList().Length > 0){
    121.  
    122.                 refreshing = false;
    123.                 hostData = MasterServer.PollHostList();
    124.             }
    125.         }
    126.     }
    127.  
    128.     function startServer(){
    129.  
    130.         if(serverPass != ""){
    131.  
    132.             Network.incomingPassword = serverPass;
    133.         }
    134.  
    135.         Network.InitializedServer(15,25001, !Network.HavePublicAddress);
    136.         MasterServer.RegisterHost(gameName,serverInfo);
    137.     }
    138.  
    139.     function OnServerInitialized(){
    140.  
    141.         DontDestroyOnLoad(transform.gameObject);
    142.  
    143.         Application.LoadLevel ("Lobby");
    144.  
    145.         lobbySpawn();
    146.     }
    147.  
    148.     function OnConnectedToServer(){
    149.  
    150.         lobbySpawn();
    151.     }
    152.    
    153.     function lobbySpawn(){
    154.  
    155.         yield WaitForSeconds(0.1);
    156.  
    157.         var made = Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
    158.  
    159.         made.GetComponent(playerMove).playerName = playerName;
    160.  
    161.         PlayerPrefs.SetString("Player Name").playerName;
    162.  
    163.         if(Network.isClient){
    164.  
    165.             Destroy(this);
    166.         }
    167.     }
    168.  
    169.     function refreshHostList(){
    170.  
    171.         MasterServer.ClearHostList();
    172.         MasterServer.RequestHostList(gameName);
    173.         refreshing = true;
    174.     }
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    As you can see in the docs, BeginScrollView requires a Rect, Vector2, and Rect (and some GUIStyle stuff that's optional). You wouldn't use a string with it.

    --Eric
     
  3. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  4. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255

    Sorry but i dont see whats wrong.. Please?
     
  5. EdgarCarrera

    EdgarCarrera

    Joined:
    Apr 21, 2014
    Posts:
    255
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    Your scrollPosition variable is a string. It has to be a Vector2.

    --Eric
     
    EdgarCarrera likes this.
  7. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Did the link to others who had experienced this problem, and got help from the community not help you?