- Home /
The question is answered, right answer was accepted
Language menu problem
Hi , this is my first time on unity answers.
Here is my code:
#pragma strict
var customGuiStyle : GUIStyle;
var customGuiStyle2 : GUIStyle;
var Menu : Menu;
var tex1 : Texture;
var Opciones : Opciones;
var Ayuda : Ayuda;
var Desenfoque : GameObject;
var exit : Texture;
Desenfoque.active = false;
print (Application.systemLanguage);
function OnGUI () {
GUI.Box (Rect (0,0,256,30),"Lg " + Application.systemLanguage.ToString());
if (Application.systemLanguage.Spanish){
if (Screen.width == 480 && Screen.height == 320){
GUI.Box (Rect (150,2,256,100), tex1, customGuiStyle2);
if (GUI.Button (Rect (350,255,128,64), "Ayuda", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled =true;
}
if (GUI.Button (Rect (350,185,128,64), "Opciones", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (350,115,128,64), "Nuevo", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (350,45,128,64), "Continuar", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
else if (Screen.width == 800 && Screen.height == 480){
GUI.Box (Rect (250,2,256,128), tex1, customGuiStyle2);
if (GUI.Button (Rect (600,255,128,64), "Ayuda", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled =true;
}
if (GUI.Button (Rect (600,185,128,64), "Opciones", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (600,115,128,64), "Nuevo", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (600,45,128,64), "Continuar", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
else if (Screen.width +800 && Screen.height +480){
GUI.Box (Rect (400,2,256,128), tex1, customGuiStyle2);
if (GUI.Button (Rect (710,255,128,64), "Ayuda", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled =true;
}
if (GUI.Button (Rect (710,185,128,64), "Opciones", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (710,115,128,64),"Nuevo", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (710,45,128,64), "Continuar", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
else if (Application.systemLanguage.English){
if (Screen.width == 480 && Screen.height == 320){
GUI.Box (Rect (150,2,256,100), tex1, customGuiStyle2);
if (GUI.Button (Rect (350,255,128,64), "Help", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled =true;
}
if (GUI.Button (Rect (350,185,128,64), "Settings", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (350,115,128,64), "New", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (350,45,128,64), "Continue", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
else if (Screen.width == 800 && Screen.height == 480){
GUI.Box (Rect (250,2,256,128), tex1, customGuiStyle2);
if (GUI.Button (Rect (600,255,128,64), "Help", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled =true;
}
if (GUI.Button (Rect (600,185,128,64), "Settings", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (600,115,128,64), "New", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (600,45,128,64), "Continue", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
else if (Screen.width +800 && Screen.height +480){
GUI.Box (Rect (400,2,256,128), tex1, customGuiStyle2);
if (GUI.Button (Rect (710,255,128,64), "Help", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = false;
Ayuda.enabled = true;
}
if (GUI.Button (Rect (710,185,128,64), "Settings", customGuiStyle)) {
Menu.enabled = false;
Opciones.enabled = true;
}
if (GUI.Button (Rect (710,115,128,64), "New", customGuiStyle)) {
Application.LoadLevel (1);
}
if (GUI.Button (Rect (710,45,128,64), "Continue", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
}
}
}
The problem is i can get english work Thanks
I formatted your code for you, so others can read it:)
next time be sure and select all the code, and hit the "010101" button to format it
what's with this line:
else if (Screen.width +800 && Screen.height +480){
doesn't look right. what is this meant to check?
This is for devices likes tablets or galaxy nexus, resolutions up to this numbers it works Pd: Thanks for reply and waste your time on my script
Answer by Seth-Bergman · Jul 29, 2012 at 04:22 AM
what's with this line:
else if (Screen.width +800 && Screen.height +480){
doesn't look right. what is this meant to check?
either way, your brackets are wrong, the Engish part is inside the spanish part, add a bracket here like this:
if (GUI.Button (Rect (710,45,128,64), "Continuar", customGuiStyle)) {
Application.LoadLevel ("fk");
}
}
} // add bracket here
else if (Application.systemLanguage.English){
and get rid of one at the end :)
EDIT:
make sure you saved, this is DEFINITELY an issue.
if you do this, all of the buttons with spanish are enclosed in the if statement:
if (Application.systemLanguage.Spanish){
but maybe the other problem is you should say
if (Application.systemLanguage == SystemLanguage.Spanish){
since it's an enum, this is how you should compare, I think
You save my life sir , you are awesome , many thanks ^w^
Have a nice day :)
Follow this Question
Related Questions
Pause Menu Not Pausing 3 Answers
Create Android Menu Item (3 vertical dots and Back Arrow button) 0 Answers
Android Button Text 1 Answer
Changing level on Android 3 Answers
Whats the best way to implement different languages? 2 Answers