import System.Collections.Generic;
var setupController : SetUpController;
var allPlayers = new List.<GameObject>();
var townspeoplePlayers = new List.<GameObject>();
var maffiaPlayers = new List.<GameObject>();
var isMaffiaVote : boolean;
private var window = Rect(50, 50, 100, 100);
private var window2 = Rect(50, 50, 100, 100);
function Start() {
setupController = GameObject.Find("Name").GetComponent("SetUpController");
}
function Update(){
allPlayers = setupController.allPlayersList;
maffiaPlayers = setupController.mafiaList;
townspeoplePlayers = setupController.townspeopleList;
}
function OnGUI ()
{
if (isMaffiaVote){
GUILayout.FlexibleSpace();
window = GUILayout.Window (5, window, MafiaVoteWindow, "Mafia Vote");
}
else{
window2 = GUILayout.Window (4, window2, AllVoteWindow, "Vote");
}
}
function AllVoteWindow (id2 : int) {
if (!isMaffiaVote){
GUILayout.BeginVertical();
for (var ap in allPlayers)
{
if (GUILayout.Button(ap.name))
{
}
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
}
}
function MafiaVoteWindow (id : int) {
if (isMaffiaVote){
GUILayout.BeginVertical();
for (var tpp in townspeoplePlayers)
{
if (GUILayout.Button(tpp.name))
{
}
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
}
}
Both GUI windows are showing up at the same time whether or not “isMafiaVote” is true or not. I suck at GUI, can someone tell me what is going on here?