- Home /
ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
i keep getting this wierd error every time i press a gui button i made? Im making a room menu screen with photon. this is the error:
ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
and here is my code:
using UnityEngine;
using System.Collections;
public class ButtonsAtTop : MonoBehaviour {
public Texture LogOutTexture;
public Texture Shop;
public Texture Inventory;
public Texture Friends;
public Texture Chat;
public Texture CharacterCustom;
bool displayWindowForShop=false;
bool displayWindowForInventory=false;
bool displayWindowForFriends=false;
bool displayWindowForChat=false;
bool displayWindowForCharacterCustom=false;
public Rect showWindowRectForShop;
public Rect showWindowRectForFriends;
public Rect showWindowRectForInventory;
public Rect showWindowRectForChat;
public Rect showWindowRectForCharacterCustom;
void Start()
{
showWindowRectForShop=new Rect(Screen.width-750, (Screen.height/2)-250, 500, 500);
showWindowRectForChat=new Rect(Screen.width-750, (Screen.height/2)-250, 500, 500);
showWindowRectForFriends=new Rect(Screen.width-750, (Screen.height/2)-250, 500, 500);
showWindowRectForChat=new Rect(Screen.width-750, (Screen.height/2)-250, 500, 500);
showWindowRectForCharacterCustom=new Rect(Screen.width-750, (Screen.height/2)-250, 500, 500);
}
void Update()
{
}
void OnGUI()
{
if (GUI.Button (new Rect (Screen.width - 50, 0, 50, 50), LogOutTexture))
{
PhotonNetwork.Disconnect();
}
if (GUI.Button (new Rect (Screen.width - 100, 0, 50, 50), Shop))
{
displayWindowForShop=!displayWindowForShop;
}
if(GUI.Button (new Rect (Screen.width - 150, 0, 50, 50),Inventory))
{
displayWindowForInventory=false;
}
if(GUI.Button (new Rect (Screen.width - 200, 0, 50, 50),Friends))
{
displayWindowForFriends=false;
}
if(GUI.Button (new Rect (Screen.width - 250, 0, 50, 50),Chat))
{
displayWindowForChat=false;
}
if(GUI.Button (new Rect (Screen.width - 300, 0, 50, 50),CharacterCustom))
{
displayWindowForCharacterCustom=false;
}
if(GUI.Button(new Rect((Screen.width)-100,(Screen.height/2)-50,100,100),"Play Game"))
{
Application.LoadLevel("Room]");
}
/////////////////////////////////////////////////////////////////////////////////////////////////
if (displayWindowForShop)
{
showWindowRectForShop=GUI.Window(0, showWindowRectForShop, ShopWindow, "Shop Window");
}
if (displayWindowForInventory)
{
showWindowRectForInventory=GUI.Window(1,showWindowRectForInventory , InventoryWindow, "Inventory");
}
if (displayWindowForFriends)
{
showWindowRectForFriends=GUI.Window(2,showWindowRectForFriends , FriendsWindow, "Friends");
}
if (displayWindowForChat)
{
showWindowRectForChat=GUI.Window(3,showWindowRectForChat , ChatWindow, "Chat");
}
if (displayWindowForCharacterCustom)
{
showWindowRectForCharacterCustom=GUI.Window(4 ,showWindowRectForCharacterCustom , CharacterCustomWindow, "Character Customisation");
}
}
void ShopWindow(int id)
{
GUI.DragWindow ();
}
void InventoryWindow(int id)
{
GUI.DragWindow ();
Debug.Log ("Show window for inventory");
}
void FriendsWindow(int id)
{
GUI.DragWindow ();
}
void ChatWindow(int id)
{
GUI.DragWindow ();
}
void CharacterCustomWindow(int id)
{
GUI.DragWindow ();
}
void OnDisconnectedFromPhoton()
{
Application.LoadLevel ("SciFi Level");
}
}
Comment
its not with that, its with this code:
using UnityEngine;
using System.Collections;
public class PlayersInRoom : $$anonymous$$onoBehaviour {
public ArrayList ListOFPlayers=new ArrayList();
public float $$anonymous$$ovedown;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
foreach(PhotonPlayer pl in PhotonNetwork.playerList )
{
if(ListOFPlayers.Contains(pl.name))
{
if(ListOFPlayers.IndexOf(pl.name) % 2==0)
{
GUILayout.BeginArea(new Rect(0, ListOFPlayers.IndexOf(pl.name) * (Screen.height/64) ,100,100));
GUILayout.Button(pl.name);
GUILayout.EndArea();
}
else
{
GUILayout.BeginArea(new Rect(100,ListOFPlayers.IndexOf(pl.name) * (Screen.height/64) - (Screen.height/64) ,100,100));
GUILayout.Button(pl.name);
GUILayout.EndArea();
}
}
else
{
ListOFPlayers.Add(pl.name);
}
}
}
}
Your answer
Follow this Question
Related Questions
Photon in JavaScript? 1 Answer
GUILayout element alignment issue 0 Answers
Display only for one player 2 Answers
Photon Multiplayer Viking GUI only Visible to each Player 1 Answer