Hi,
I tried with twice bigger line, and I still have the problem, some weird stuffs appear.
here is the GUI script:
// Use this for initialization
void Start()
{
//ScreenRatio
horizRatio = Screen.width / 1920f;
vertRatio = Screen.height / 1080.0f;
}
private bool ApproxEquals(float a, float b)
{
return (a <= b + 0.01 a >= b - 0.01);
}
void Update()
{
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ScreenRatio
//---------------------------------------------------------ScreenRatio
FSW = Screen.width;
FSH = Screen.height;
Ratio = FSW / FSH;
if (ApproxEquals(Ratio, 16.0f / 9.0f))
{
//Screen Ratio
SW = 1920f;
SH = 1080f;
}
if (ApproxEquals(Ratio, 16.0f / 10.0f))
{
//Screen Ratio
SW = 1920f;
SH = 1200f;
}
if (ApproxEquals(Ratio, 4.0f / 3.0f))
{
//Screen Ratio
SW = 1280f;
SH = 1024f;
}
horizRatio = Screen.width / SW;
vertRatio = Screen.height / SH;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TTSpx = MX - TTSx / 2;
TTSpy = MY - TTSy;
if (TTOnOff == true)
{
TTpx = MX - TTx[TTi] / 2 - 20;
TTpy = MY;
}
if (TT2OnOff == true)
{
TT2px = MX - TT2x[TTi] / 2 - 20;
TT2py = MY - TT2y;
}
}
void OnGUI()
{
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Utilities
//Aspect Ratio
GUI.matrix = Matrix4x4.TRS(new Vector3(0f, 0f, 0f), Quaternion.identity, new Vector3(horizRatio, vertRatio, 1));
//ToolTips Mouse position
MX = Event.current.mousePosition.x;
MY = Event.current.mousePosition.y;
//------------------------------------------------------------------INTERFACE
//TOP
GUI.Label(new Rect(SW/2 - Logox/2, LogoPy, Logox,Logoy),"",PersistantObject.MyUni);
if (GUI.Button(new Rect(SW - BTP - BTS, BTP, BTS, BTS), new GUIContent("", "TClose"), PersistantObject.Close))
{
Application.Quit();
}
if (GUI.Button(new Rect(SW - BTP - 2 * BTS - BTE, BTP, BTS, BTS), new GUIContent("", "THelp"), PersistantObject.Help))
{
}
if (GUI.Button(new Rect(SW - BTP - 3 * BTS - 2 * BTE, BTP, BTS, BTS), new GUIContent("", "TMini"), PersistantObject.Mini))
{
}
if (InfoOnOff == true)
{
PersistantObject.Interrupteur = false;
PersistantObject.Interrupteur2 = false;
GUI.Label(new Rect(SW / 2 - 483, SH / 2 - 189 - PersistantObject.DialPy, 966, 378), "", Dialogue40);
if (GUI.Button(new Rect(SW / 2 + 300, SH / 2 + 100 - PersistantObject.DialPy, 92, 34), "", BOk))
{
PersistantObject.Interrupteur = true;
PersistantObject.Interrupteur2 = true;
InfoOnOff = false;
}
}
if (QuestionsOnOff == true)
{/*
if (Q0 == true)//-------------------------------------------------------------------------Hey we need to know more about you.
{
GUI.Label(new Rect(SW / 2 - 275, SH / 2 - 100, 550, 200), "", Empty);
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 30, 827, 34), "Next"))
{
PersistantObject.Campus = 1;
Q1 = true;
Q0 = false;
}
}*/
if (Q1 == true)//-------------------------------------------------------------------------[Stoke] OR [Stafford]
{
GUI.Label(new Rect(SW / 2 - 483, SH / 2 - 189 - PersistantObject.DialPy, 966, 378), "", Dialogue20);
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 - 20 - PersistantObject.DialPy, 827, 34), "", BCampus2))
{
PersistantObject.Campus = 2;
Q2 = true;
Q1 = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 36 - PersistantObject.DialPy, 827, 40), "", BCampus1))
{
PersistantObject.Campus = 1;
Q2 = true;
Q1 = false;
}
}
if (Q2 == true)//-------------------------------------------------------------------------[Halls of Residence] OR [At Home] OR [Private Accommodation]
{
GUI.Label(new Rect(SW / 2 - 483, SH / 2 - 189 - PersistantObject.DialPy, 966, 378), "", Dialogue21);
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 - 56 - PersistantObject.DialPy, 827, 34), "", BHall))
{
PersistantObject.Accomodation = 1;
Q3 = true;
Q2 = false;
}
else if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 - 5 - PersistantObject.DialPy, 827, 34), "", BHome))
{
PersistantObject.Accomodation = 2;
Q4 = true;
Q2 = false;
}
else if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 46 - PersistantObject.DialPy, 827, 34), "", BPrivate))
{
PersistantObject.Accomodation = 3;
Q4 = true;
Q2 = false;
}
}
if (Q3 == true)//-------------------------------------------------------------------------[Dropdown List of Halls]
{
GUI.Label(new Rect(SW / 2 - 483, SH / 2 - 189 - PersistantObject.DialPy - Dial22Py, 966, Dial22y), "", Dialogue22[0]);
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 - 35 - PersistantObject.DialPy - Dial22Py, 827, 34), "", DropList))
{
Drop = !Drop;
}
if (Drop == true)
{
if (PersistantObject.Campus == 1)
{
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 16 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop1))
{
PersistantObject.StudAcc = 0;
DropList = Drop1;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 66 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop2))
{
PersistantObject.StudAcc = 1;
DropList = Drop2;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 115 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop3))
{
PersistantObject.StudAcc = 2;
DropList = Drop3;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 166 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop4))
{
PersistantObject.StudAcc = 3;
DropList = Drop4;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 216 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop5))
{
PersistantObject.StudAcc = 4;
DropList = Drop5;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 265 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop6))
{
PersistantObject.StudAcc = 5;
DropList = Drop6;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 316 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop7))
{
PersistantObject.StudAcc = 6;
DropList = Drop7;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 366 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop8))
{
PersistantObject.StudAcc = 7;
DropList = Drop8;
DropSelected = true;
Drop = false;
}
}
else{
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 16 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop1a))
{
PersistantObject.StudAcc = 1;
DropList = Drop1a;
DropSelected = true;
Drop = false;
}
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 66 - PersistantObject.DialPy - Dial22Py, 827, 34), "", Drop2a))
{
PersistantObject.StudAcc = 2;
DropList = Drop2a;
DropSelected = true;
Drop = false;
}
}
}
if (Drop == false)
{
if (GUI.Button(new Rect(SW / 2 + 300, SH / 2 + 100 - PersistantObject.DialPy - Dial22Py, 92, 34), "", BNext) DropSelected == true)
{
Q4 = true;
Q3 = false;
}
}
}
if (Q4 == true)//-------------------------------------------------------------------------NEXT
{
GUI.Label(new Rect(SW / 2 - 483, SH / 2 - 189 - PersistantObject.DialPy, 966, 378), "", Dialogue23);
if (GUI.Button(new Rect(SW / 2 + 300, SH / 2 + 100 - PersistantObject.DialPy, 92, 34), "", BOk))
{
Q4 = false;
PersistantObject.Objectif = 1;
if (PersistantObject.Campus == 1)
{
Application.LoadLevel(4);
}
else
{
Application.LoadLevel(3);
}
}
}
}
}
the problem is located on theses buttons, not the labels (like the following line):
if (GUI.Button(new Rect(SW / 2 - 827 / 2, SH / 2 + 36 - PersistantObject.DialPy, 827, 40), "", BCampus1))
Do someone has any idea how can I fix that problem ?
Please help, it’s becoming urgent…