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 David C · Jun 16, 2011 at 03:05 PM · gui

drawing a line through a GUI label

hello,

i was trying to find out how i would go about drawing a line through a label from code. do i draw a line then place it in the right place and activate it when i need or can i do it in the GUI.label?

thanks

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 David C · Jun 16, 2011 at 04:44 PM 0
Share

is this impossible or very simple and i am just missing something?

avatar image Chris D · Jun 16, 2011 at 05:02 PM 0
Share

Do you mean producing something like this on your GUI labels?

2 Replies

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

Answer by fireDude67 · Jun 16, 2011 at 05:13 PM

I would just go into Photoshop/Paint.NET or another image-editor and make an image with a transperent background. Then, you should get the Text tool, and type your text and adjust font/size/color/etc. as you wish. Then, save this image.

Next, make a copy of the previous image, and draw a line through it in the image program. Save this as a different file.

You should now have 2 different text images, one with a line through it and one without a line through it.

Now, you can display the first image as a GUITexture. Then, make a new script:

 var strikedImage : Texture2D; // Assign this variable wit the image with a line through it.
 function Update() {
    if (Input.GetKeyDown("space")) { // Or another trigger, it does not matter
       this.texture = strikedImage;
    }
 }

Next, create a new GUITexture from GameObject -> Create Other... -> GUITexture (is that right?) and for the Texture variable, assign the first image (the one without the line through it) to it. Then, drag the above script onto it. Set the strikedImage variable to the image WITH the line through it.

Finally, when you run the game, pressing space will change the image.

[1]: http://unity3d.com/support/documentation/Components/class-GuiTexture.html[GUITexture][1]

Comment
Add comment · Show 3 · 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 David C · Jun 16, 2011 at 05:46 PM 0
Share

thats perfect thanks very much

avatar image fireDude67 · Jun 16, 2011 at 06:59 PM 0
Share

You're Welcome! Did it work?

avatar image David C · Jun 17, 2011 at 04:11 PM 0
Share

yes thanks

avatar image
0

Answer by Eric5h5 · Jun 16, 2011 at 07:28 PM

Use this for drawing lines in OnGUI functions.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Setting Scroll View Width GUILayout 1 Answer

What is frame, How OnGuI is called every frame? 2 Answers

'MouseLook.sensitivityX' is inaccessible due to its protection level. 2 Answers

Is this a problem of unity 3 or i am doing something wrong. 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