Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Adam 10 · Aug 10, 2011 at 06:39 AM · updatetextarea

TextArea not properly updating

So I am stumped, I have

 function OnGUI(){
                     txtIndex = EditorGUILayout.Popup(txtIndex, temp,GUILayout.Width(100));
             if(txtIndex != 0){
                 var sr : StreamReader = new StreamReader(filename);
                 notepad = sr.ReadToEnd();
                 sr.Close();
                     txtIndex = 0;
              }
             notepad = EditorGUI.TextArea(Rect(0,0,550,600),notepad, GUI.skin.customStyles[0]);
 }

At first the TextArea is my String set as "Default", then when I go to the popup and select a file to load it loads the file and as long as I don't make any changes to the text area I can load other files without issue.

Now when I make a change and then switch to a file I know from other code that the file is loaded, but the textarea stays as whatever change I set it to. Now if I click off the window it changes the textarea to the file text, but when I click back on the Window the textarea changes right back to the text I had changed prior to reloading a text file. I just cant wrap my head around it, I dont want to leave the txtIndex to the file I selected as this wouldn't allow for changes to the text if I needed.

I probably have to explain this a little further, but I am tired and been stuck on this for awhile. Thanks in advance.

Comment
Add comment · Show 2
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 Eric5h5 · Oct 22, 2011 at 07:56 PM 0
Share

There's no reason to put "[closed]" in your question titles, especially since they're not really closed. Just mark the answer as accepted. Also don't post comments as answers.

avatar image Adam 10 · Oct 22, 2011 at 09:02 PM 0
Share

Oh, I saw others I guess done wrong so I thought I should do it. Thanks for correcting me. Not sure where I did the comment as an answer, but ok.

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by jonas-echterhoff · Aug 10, 2011 at 12:55 PM

While you are editing a TextArea or TextField, changes to the source string will not be picked up by the text editor. You could try removing Focus from the TextArea when you want to change the text by calling:

 GUIUtility.keyboardControl = 0;
 GUIUtility.hotControl = 0;
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 Adam 10 · Aug 13, 2011 at 04:30 AM 0
Share

Your Awesome THAN$$anonymous$$ YOU!!!, took a $$anonymous$$ute to get it to work because I have to remember to remove things I try to get to work that don't, lol. I had a bool in there i was only setting to false and couldn't figure out why even what i had before wasn't working.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Regaining system resources? 1 Answer

Question on Update() 1 Answer

Update increment error (2 + 1 = 0?) 1 Answer

Update - Delaying until next frame? 0 Answers

How to refresh my webplayer at runtime 3 Answers


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