Hello,
I have a gui menu that does not appear on Mac Os WebPlayer although when i run the build on Windows it appears perfectly, same in unity editor.
Basically i have a few Gui.BeginGroup - Gui.EndGroup with some DrawTexture and Gui Buttons.
What is the difference between them?
I create the build on a windows 7 x64 system.
here is my code
void OnGUI ()
{
//drawer gui group
GUI.BeginGroup (new Rect (drawerLeft, menuBarHeight, drawerWidth, Screen.height - menuBarHeight));
//background texture
GUI.DrawTexture (new Rect (0, 0, drawerWidth - btnDrawer.width + btnDrawerPadding, drawerTextBckgrndHeight - menuBarHeight), drawerTextBckgrnd);
GUI.DrawTexture (new Rect (0, drawerTextBckgrndHeight - menuBarHeight, drawerWidth - btnDrawer.width + btnDrawerPadding,
drawerVideoBckgrndHeight), drawerVideoBckgrnd);
//movie texture
GUI.DrawTexture (movieRect, mCurrentMovie);
//text display
GUI.Label (new Rect (titleMarginLeft, titleMarginTop, drawerWidth - btnDrawer.width - titleMarginLeft * 3,
titleMarginTop), drawerTitle, drawerTitleStyle);
GUI.Label (new Rect (titleMarginLeft, titleMarginTop * 4, drawerWidth - btnDrawer.width - titleMarginLeft * 3,
drawerTextBckgrndHeight - menuBarHeight - titleMarginTop * 4), drawerText, drawerTextStyle);
//drawer button
if (GUI.Button (new Rect (drawerWidth - btnDrawer.width, Screen.height / 2 - btnDrawer.height / 2,
btnDrawer.width, btnDrawer.height), btnDrawer, btnDrawerStyle)) {
drawerLerpTimerStart = 0;
if (drawerShouldLerp) {
drawerShouldLerp = false;
drawerShouldLerpBack = true;
} else if (drawerShouldLerpBack) {
drawerShouldLerp = true;
drawerShouldLerpBack = false;
mCurrentMovie.Stop ();
shouldInitVideo = true;
videoInitStartTime = Time.time;
} else if (!drawerShouldLerpBack && !drawerShouldLerp) {
drawerShouldLerp = true;
drawerShouldLerpBack = false;
mCurrentMovie.Stop ();
shouldInitVideo = true;
videoInitStartTime = Time.time;
}
}
GUI.EndGroup ();
// gui menu bar
currentGuiElementLeft = 0;
GUI.DrawTexture (new Rect (0.0f, 0.0f, Screen.width, menuBarHeight + menuBackgroundFadeHeight), menuBckgrnd);
GUI.BeginGroup (new Rect (0.0f, 0.0f, Screen.width, menuBarHeight + menuBackgroundFadeHeight - 1.0f));
//background texture
GUI.DrawTexture (new Rect (0.0f, 0.0f, Screen.width, menuBarHeight + menuBackgroundFadeHeight), menuBckgrnd);
GUI.Label (new Rect (menuLogoLeft, menuLogoTop, menuLogoWidth, menuLogoHeight), new GUIContent ("CitoPress", menuLogo), logoStyle);
//help button
currentGuiElementLeft = Screen.width - btnMenuWidth;
if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth, btnMenuHeight), "", btnMenuHelpStyle)) {
shouldRenderHelp=true;
}
currentGuiElementLeft -= menuDivider.width;
GUI.DrawTexture (new Rect (currentGuiElementLeft, 0, menuDivider.width, btnMenuHeight), menuDivider);
//zoom button
currentGuiElementLeft -= btnMenuWidth;
if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth, btnMenuHeight), "", btnMenuZoomStyle)) {
if (shouldShowBulletZoomBar) {
shouldShowBulletZoomBar = false;
btnMenuZoomStyle.normal.background = (Texture2D)Resources.Load ("meta/toggle_zoom");
} else {
shouldShowBulletZoomBar = true;
btnMenuZoomStyle.normal.background = (Texture2D)Resources.Load ("meta/toggle_zoom_pressed");
}
}
currentGuiElementLeft -= menuDivider.width;
GUI.DrawTexture (new Rect (currentGuiElementLeft, 0, menuDivider.width, btnMenuHeight), menuDivider);
//language button
currentGuiElementLeft -= btnMenuWidth;
if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth, btnMenuHeight), "", btnMenuLanguageStyle)) {
shouldRenderLangSelection = true;
}
currentGuiElementLeft -= menuDivider.width;
GUI.DrawTexture (new Rect (currentGuiElementLeft, 0, menuDivider.width, btnMenuHeight), menuDivider);
// enable/disable hotspot texts
currentGuiElementLeft -= btnMenuWidth * 2;
if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth * 2, btnMenuHeight), "", btnMenuHotSpotsTextStyle)) {
textLerpTimerStart = 0;
if (shouldShowBulletTexts) {
shouldShowBulletTexts = false;
btnMenuHotSpotsTextStyle.normal.background = (Texture2D)Resources.Load ("meta/toggle_text_off");
} else {
shouldShowBulletTexts = true;
btnMenuHotSpotsTextStyle.normal.background = (Texture2D)Resources.Load ("meta/toggle_text_on");
}
}
currentGuiElementLeft -= menuDivider.width;
GUI.DrawTexture (new Rect (currentGuiElementLeft, 0, menuDivider.width, btnMenuHeight), menuDivider);
// enable/disable hotspots
currentGuiElementLeft -= btnMenuWidth;
if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth, btnMenuHeight), "", btnMenuHotSpotsStyle)) {
if (shouldShowBullets) {
shouldShowBullets = false;
for (int i=0; i<bullets.Length; i++) {
bullets *.SetActive (false);*
-
}*
-
} else {*
-
shouldShowBullets = true;*
-
for (int i=0; i<bullets.Length; i++) {*
_ bullets .SetActive (true);_
* }*
* }*
* }*
* currentGuiElementLeft -= menuDivider.width;*
* GUI.DrawTexture (new Rect (currentGuiElementLeft, 0, menuDivider.width, btnMenuHeight), menuDivider);*
* //reset button*
* currentGuiElementLeft -= btnMenuWidth;*
* if (GUI.Button (new Rect (currentGuiElementLeft, 0, btnMenuWidth, btnMenuHeight), “”, btnMenuResetStyle)) {*
* Application.LoadLevel (Application.loadedLevel);*
* }*
* GUI.EndGroup ();*
* //render zoom scrollbar*
* if (shouldShowBulletZoomBar) {*
* Camera.main.fieldOfView = GUI.VerticalSlider (new Rect (Screen.width - zoomBarRightMargin,*
* zoomBarTopMargin, zoomBarWidth, Screen.height - zoomBarTopMargin),*
* Camera.main.fieldOfView, 120.0f, 15.0f, zoomBarSliderStyle, zoomBarThumbStyle);*
* }*
* //language selection GUI*
* if (shouldRenderLangSelection) {*
* GUI.BeginGroup (new Rect (0.0f, 0.0f, Screen.width, Screen.height), helpBackground);*
_ if (GUI.Button (new Rect (Screen.width * 0.5f - helpEnglish.width * 2 - helpLanguageSpacing * 1.5f,
Screen.height * 0.5f - helpEnglish.height * 0.5f, helpEnglish.width, helpEnglish.height), new GUIContent (“English”, helpEnglish), helpLanguageStyle)) {
* shouldRenderLangSelection = false;*
* mLangStrings = new MultiLanguageScript (“English”);*
* reloadTexts ();*
* }*
if (GUI.Button (new Rect (Screen.width * 0.5f - helpEnglish.width - helpLanguageSpacing * 0.5f,
Screen.height * 0.5f - helpEnglish.height * 0.5f, helpEnglish.width, helpEnglish.height), new GUIContent (“Deutsch”, helpGerman), helpLanguageStyle)) {
* shouldRenderLangSelection = false;*
* mLangStrings = new MultiLanguageScript (“German”);*
* reloadTexts (); *
* }*
if (GUI.Button (new Rect (Screen.width * 0.5f + helpLanguageSpacing * 0.5f,
Screen.height * 0.5f - helpEnglish.height * 0.5f, helpEnglish.width, helpEnglish.height), new GUIContent (“Francais”, helpFrench), helpLanguageStyle)) {
* shouldRenderLangSelection = false;*
* mLangStrings = new MultiLanguageScript (“French”);*
* reloadTexts ();*
* }*
if (GUI.Button (new Rect (Screen.width * 0.5f + helpEnglish.width + helpLanguageSpacing * 1.5f,
Screen.height * 0.5f - helpEnglish.height * 0.5f, helpEnglish.width, helpEnglish.height), new GUIContent (“Chinese”, helpChinese), helpLanguageStyle)) {_
* shouldRenderLangSelection = false;*
* mLangStrings = new MultiLanguageScript (“Japanese”);*
* reloadTexts ();*
* }*
* GUI.EndGroup ();*
* }*
* //drawer open/close animation*
* if (drawerShouldLerp) {*
* drawerLerpTimer = (drawerLerpTimerStart += Time.deltaTime) / 6;*
* drawerLeft = Mathf.SmoothStep (drawerLeft, 0, drawerLerpTimer);*
* } else if (drawerShouldLerpBack) {*
* drawerLerpTimer = (drawerLerpTimerStart += Time.deltaTime) / 6;*
* drawerLeft = Mathf.SmoothStep (drawerLeft, - drawerWidth + btnDrawer.width, drawerLerpTimer);*
* }*
* //show Help*
* if (shouldRenderHelp) {*
* GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), menuHelp);*
* }*
* //fade in /out bullet text*
* if (shouldShowBulletTexts) {*
* textLerpTimer = (textLerpTimerStart += Time.deltaTime) / 3;*
* for (int i=0; i<bullets.Length; i++) {*
_ Color tempColor = bullets .guiText.material.color;
* tempColor.a = Mathf.Lerp (0.0f, 1.0f, textLerpTimer);
bullets .guiText.material.color = tempColor;
tempColor = bulletBacks .guiTexture.color;
tempColor.a = Mathf.Lerp (0.0f, 1.0f, textLerpTimer);
bulletBacks .guiTexture.color = tempColor;
}*_
* } else {*
* textLerpTimer = (textLerpTimerStart += Time.deltaTime) / 3;*
* for (int i=0; i<bullets.Length; i++) {*
_ // Fade.use.Alpha(bullets*, 1.0f, 0.0f, 1.0f);
Color tempColor = bullets .guiText.material.color;
tempColor.a = Mathf.Lerp (1.0f, 0.0f, textLerpTimer);*
bullets .guiText.material.color = tempColor;_
_ tempColor = bulletBacks .guiTexture.color;
* tempColor.a = Mathf.Lerp (1.0f, 0.0f, textLerpTimer);
bulletBacks .guiTexture.color = tempColor;
}
}
}*
Please note that the “//Drawer button” appears correctly on Mac Os too, and the “//text display” appears in the top left corner (although at launch they should be outside the screen in the left)
I have looked everywhere on the forum but i couldn’t find a solution or a similar issue with an answer.
Any advice is much appreciated_