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 /
avatar image
0
Question by H.B.D · Dec 06, 2013 at 02:51 PM · guiguilayouttextfieldguilayout.textfield

GUILayout Textfield not editable just static

Hey,,

I am having trouble with my code with in each count it's suppose to view the items as a editable textfield but instead it shows row text in the OnGUI method

here is the code //Just some basic styles for the items

 GUIStyle itemsContent = new GUIStyle (GUI.skin.textArea);
 itemsContent.fontSize= 14;
 Color32 textcolor = new Color32 (139,90,43,255);
 itemsContent.normal.textColor = textcolor;
 itemsContent.normal.background = null;
 itemsContent.hover.textColor= textcolor;
 GUI.backgroundColor = Color.clear;
 
 //for loop for getting items and setting them for the user
 for(cnt = 0 ; cnt <  numofLabels ; cnt++){
 
 GUI.backgroundColor = Color.yellow;
                 
 itemTemp = items[cnt].getItms(); // array which has items from DB
 
                 
 GUI.Box(new Rect(610,200+(70*cnt),260,70),"Items List: " + GUILayout.TextField(itemTemp,25) +"\n",itemsContent);
     
 }


Thank you so much

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robhuhn · Dec 06, 2013 at 03:22 PM

GUILayout.TextField() can not be concatenated with strings **. You need to place the gui items next to each other manually.

E.g.

 GUILayout.BeginArea(new Rect(610,200,260,70));
 {
     GUILayout.BeginVertical();
     {
         for(cnt = 0 ; cnt <  numofLabels ; cnt++)
         {
             GUI.backgroundColor = Color.yellow;
             itemTemp = items[cnt].getItms();

             GUILayout.BeginHorizontal();
             {
                 GUILayout.Box("Items List: ", itemsContent);
                 itemTemp = GUILayout.TextField(itemTemp,25);
             }
             GUILayout.EndHorizontal();
         }
         GUILayout.EndVertical();
 }
 GUILayout.EndArea();

*not tested

I'm not sure if itemTemp is a string or something else but I guess you want to store it again after it was edited.

@Edit ** actually the return value can be concatenated but the returned string isn't stored then afaik

Comment
Add comment · Show 1 · Share
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
avatar image H.B.D · Dec 06, 2013 at 05:17 PM 0
Share

i tried your code but now nothing shows it just shows items list :(

i am trying to make a list of editable items using guiLayout.textfield but my code logic seems invalid

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

17 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 avatar image

Related Questions

Sideways textfield 1 Answer

TextField does not show up 2 Answers

Instantiating a text field 0 Answers

Styling an individual button in SelectionGrid 0 Answers

Text fields where text will scale along with resolution. 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