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
0
Question by Jeff Lowe · Feb 20, 2010 at 05:04 PM · guitextwindow

Mouse click selecting word in GUI

I'm attempting to make specific words in a GUI.Window click activated (text message appears in window, user clicks on one specific word, and an action happens). I've recently found the GUISettings.doubleClickSelectsWord option, but no reference to exactly how it works or how to use it.

How would I use this to enable click activation of text in the GUI.Window. Then, how do I reference in the script which word was clicked so I can make a specific action happen?

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

2 Replies

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

Answer by Sebas · Feb 21, 2010 at 03:38 AM

I haven't dealt with GUISettings.doubleClickSelectsWord yet, but I suspect that it won't do what you're after. It's used for text fields where the user enters text. Double-clicking on the word would highlight this word just like in a text editor.

I'd probably go for GUI.button and use the words that you need as texture. If you then click on the word, the button registers a click and you can trigger stuff. That would fairly resemble what you're after. Not perfect, but probably more suitable then a text field.

Comment
Add comment · Show 2 · 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 Jeff Lowe · Feb 22, 2010 at 10:29 PM 0
Share

If double-clicking word in the text field selects the text word, how do you access that word in the script, or is there a way? I would love to hear form someone that has used this command too.

avatar image Sebas · Feb 22, 2010 at 10:54 PM 0
Share

The text field is still intended for the user to manipulate the string. I doubt it's useful for displaying a string and having the user click on something. From the documentation you can only access the complete string of the text field, not the "highlighted" substring. If somebody has experience with using a text field for such purpose, I'd be keen to hear that as well.

avatar image
0

Answer by Ashkan_gc · Jun 13, 2010 at 11:52 AM

unity's GUI is a litle different from what you see in other GUI packages. you can get the click event of a button easily or you can use toolbars or selection grids but if you need to get the selected word in a textfield it's not easy. you should use GUIUtility and GUI classes with Event class to work with GUIs in advanced. there are two problems. 1 the documentation of GUIUtility is not complete by no means and getting the info about the text in a textfield needs much more effort. you should opentype library and know the font well to understand the size of the texture for some word and ... don't try it :)

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

What's wrong with my function? It keeps telling me 'loseText' is not a member of 'UnityEngine.GUIText'. Please help, please and thank you! 0 Answers

How can I use Rect.Contains with GUI.Window? 1 Answer

How will i get new line in window data? 1 Answer

Problem with GuiFont - Not appearing 0 Answers

How to make GUI Text appear after a certain amount of time 2 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