- Home /
Unity ERROR BCE0023
Unity ERROR: Assets/Scripts/networking.js(66,61): BCE0023: No appropriate version of 'UnityEngine.GUI.BeginScrollView' for the argument list '(UnityEngine.Rect, String, UnityEngine.Rect)' was found.
My Script:
@script ExecuteInEditMode()
var gameName : String = "Mattsgamesfortesting";
var refreshing = false;
var hostData : HostData[];
var create = false;
var joining = false;
var serverName = "";
var serverInfo = "";
var serverPass = "";
var playerName = "";
var clientPass = "";
var scrollPosition = "";
function Start(){
playerName = PlayerPrefs.GetString("Player Name");
}
function OnGUI(){
if(!Network.isClient && !Network.isServer){
if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/2,100,20),"Create Game")){
create = true;
}
if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/2 + 30,100,20),"Create Game")){
joining = true;
refreshHostList();
}
}
if(create){
if(GUI.Button(Rect(Screen.wigth/2 - 50,Screen.height/3 + 110,100,50),"Create")){
startServer();
}
GUI.Label(Rect(Screen.width/2 - 110,Screen.height/3,100,20),"Server Name:");
GUI.Label(Rect(Screen.width/2 + 40,Screen.height/3,100,20),"Password:");
GUI.Label(Rect(Screen.width/2 - 30,Screen.height/3 + 90,100,20),"Server Info:");
serverName = GUI.TextField (Rect(Screen.width/2 - 120,Screen.height/3 + 30, 100, 20),serverName, 12);
serverPass = GUI.PasswordField (Rect(Screen.width/2 + 20,Screen.height/3 + 30, 100, 20),serverPass, "*"[0], 12);
serverInfo = GUI.TextField (Rect(Screen.width/2 - 70,Screen.height/3 + 30, 150, 20),serverInfo, 12);
if(GUI.Button(Rect(Screen.width/1.2,Screen.height/20,100,20),"Back")){
create = false;
}
if(joining){
if(hostData){
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*/));
GUI.Label(Rect(30,0,100,20),"Game Name");
GUI.Label(Rect(350,0,100,20),"Server Info");
GUI.Label(Rect(590,0,100,20),"Player Count");
GUI.Label(Rect(700,0,100,20),"Password");
for (var i:int = 0; i < hostData.length; i++){
GUI.Label(Rect(0,30 + i * 30,200,22),hostData[i].gameName);
GUI.Label(Rect(160,30 + i * 30,500,22),hostData[i].comment);
GUI.Label(Rect(640,30 + i * 30,100,22),hostData[i].connectedPlayers + " / " + hostData[i].playerLimit);
if(hostData[i].passwordProtected){
clientPass = GUI.PasswordField(Rect(680, 30 + i * 30, 100, 25), clientPass, "*"[0], 12);
}
if(GUI.Button(Rect(800, 30 + i * 30, 100, 25), "Join")){
Network.Connect(hostData[i], clientPass);
}
}
GUI.EndScrollView();
}
if(!hostData){
GUI.Label(Rect(Screen.width/2 - 50,Screen.height/3,200,25), "No Games Found");
if(GUI.Button(Rect(Screen.width/2 - 50,Screen.height/3 + 30,105,25),"Refresh")){
refreshHostList();
}
}
if(GUI.Button(Rect(Screen.width/1.2,Screen.height/20,100,20),"Back")){
joining = false;
}
}
if(GUI.Button(Rect(Screen.width/20,Screen.height/20,100,20),"Quit")){
Application.Quit();
}
GUI.Label(Rect(Screen.width/2 - 35,Screen.height/1.2 - 30,100,20),"Your Name:");
playerName = GUI.TextField(Rect(Screen.width/2 - 50,Screen.height/1.2,100,20), playerName, 12);
}
}
function Update (){
if(refreshing){
if(MasterServer.PollHostList().Length > 0){
refreshing = false;
hostData = MasterServer.PollHostList();
}
}
}
function startServer(){
if(serverPass != ""){
Network.incomingPassword = serverPass;
}
Network.InitializedServer(15,25001, !Network.HavePublicAddress);
MasterServer.RegisterHost(gameName,serverInfo);
}
function OnServerInitialized(){
DontDestroyOnLoad(transform.gameObject);
Application.LoadLevel ("Lobby");
lobbySpawn();
}
function OnConnectedToServer(){
lobbySpawn();
}
function lobbySpawn(){
yield WaitForSeconds(0.1);
var made = Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
made.GetComponent(playerMove).playerName = playerName;
PlayerPrefs.SetString("Player Name").playerName;
if(Network.isClient){
Destroy(this);
}
}
function refreshHostList(){
MasterServer.ClearHostList();
MasterServer.RequestHostList(gameName);
refreshing = true;
}
Comment
In the future please ensure your code is properly formatted. I have fixed this post for you bit future posts may get rejected if not properly formatted.
Answer by Jeff-Kesselman · Jun 11, 2014 at 07:02 PM
Your error is exactly what it says it is. On like 66 you are passing arguments of the wrong type to BeginScrollView
Please compare the arguments you are passing, which the error says is (Rect,string,Rect) with the documentation on proper use:
http://docs.unity3d.com/ScriptReference/GUI.BeginScrollView.html