Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Clarenceonline · Sep 02, 2013 at 05:16 AM · gui buttonttsgui labelgui layout

[HELP] GUI not showing up as they should be in the C# script

please help me anyone, any help would be appreciated the gui layout, label and buttons are not showing up when i add the script to the main camera.

using UnityEngine; using System; using System.Collections;

public class Example : MonoBehaviour {

 private string [] LocalizedStrings;
 
 private static TTSBridge ttsengine;
 
 public Font unicodearial;

 string thetext = "Awesome dude! Input a phrase to speech.\n You can use enter to make a new line.\nTry something!";
 int retval;
 string deviceLanguage ="";
 string TTSLanguage ="";
 //string TTSLanguages="";
 
 float thepitch = 1.0f;
 float oldpitch = 1.0f;
 float therate = 1.0f;
 float oldrate = 1.0f;    
 
 
 #if UNITY_ANDROID
 void Start () {
     
     AndroidJNI.AttachCurrentThread();        

     // Retrieve device current language
     using (AndroidJavaClass cls = new AndroidJavaClass("java.util.Locale")) {
         using (AndroidJavaObject locale = cls.CallStatic<AndroidJavaObject>("getDefault")) {                
             deviceLanguage = locale.Call<string>("getDisplayLanguage");
         }
     }        
     // Startup vibration Java object
     ttsengine = new TTSBridge();
     ttsengine.Init();

     
 }
 #endif
 void OnGUI() {
     
     GUI.color = Color.white;
      GUI.skin.font = unicodearial;
     GUILayout.BeginArea(new Rect(20, 10, Screen.width-40, Screen.height-80));
     GUILayout.Label("Android Native TTS engine plugin example demo");
     GUILayout.Space(10.0f);            
     GUILayout.Label("device language:"+deviceLanguage);
     GUILayout.Space(10.0f);
     GUILayout.Label("TTS engine language:"+TTSLanguage);
     
     if(ttsengine.isInitialized())
         TTSLanguage = ttsengine.GetLanguage();
     
     if(GUILayout.Button("Switch to english", GUILayout.Height(40)))
     {

if UNITY_ANDROID

        retval = ttsengine.SetLanguage("inglese");
         Debug.Log( "setLanguage(US) returned: "+retval);

endif

    }
     GUILayout.Space(10.0f);
     if(GUILayout.Button("Switch to "+deviceLanguage+"(default)", GUILayout.Height(40)))
     {

if UNITY_ANDROID

        retval=ttsengine.SetLanguage("italiano");
         Debug.Log( "setLanguage(ITA) returned: "+retval);

endif

    }
     
     GUILayout.Space(40.0f);

     GUILayout.Label("Set pitch: "+thepitch);
     thepitch = GUILayout.HorizontalSlider(thepitch,0.1f,2.0f, GUILayout.Height(50));
     if (thepitch!=oldpitch)
     {
         oldpitch=thepitch;

if UNITY_ANDROID

        ttsengine.SetPitch(thepitch);

endif

    }
     
     
     GUILayout.Space(30.0f);
     GUILayout.Label("Set speed: "+therate);
     therate = GUILayout.HorizontalSlider(therate,0.5f,2.0f, GUILayout.Height(50));
     if (therate!=oldrate)
     {
         oldrate=therate;

if UNITY_ANDROID

        retval=ttsengine.SetSpeechRate(therate);        

endif

    }

     GUILayout.Space(20.0f);
     
     thetext = GUILayout.TextArea( thetext, 200 );
     GUILayout.Space(20.0f);
     if(GUILayout.Button("TALK", GUILayout.Height(80)))
     {
         // talk

if UNITY_ANDROID

        ttsengine.Speak(thetext.ToLower());

endif

    }
     GUILayout.Space(30.0f);
     GUILayout.EndArea();
     GUI.Label(new Rect(0,Screen.height-40,Screen.width,40),"Litobyte Softworks - Native TTS engine plugin v 1.1.0");
     
 }
 
 void OnApplicationQuit()
 {
     ttsengine.Dispose();
 }    

}

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Free Text to speech plugin 1 Answer

placing a GUI.Button at a specific place on multiple screen resolutions 2 Answers

What is a good component to use for a GUI inventory display? 1 Answer

i want work link(internet site) in GUI Button 2 Answers

Object in front of button 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges