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
3
Question by Whelandrew · Dec 06, 2011 at 08:29 PM · guistylegui.buttonguiskinborder

Remove Button Border

I would like to load a GUI.Button so that only the image assigned to it appears without the frame of the button on the screen. Is this possible?

Comment
Add comment · Show 1
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 dannyskim · Dec 06, 2011 at 09:45 PM 1
Share

Take a look at GUIStyle. You'll be able to customize everything from there for your GUI elements.

http://unity3d.com/support/documentation/ScriptReference/GUIStyle.html

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by gaps · Jul 11, 2014 at 02:25 PM

The best and simplest solution is to use what you may call the blank style. This works with text and texture buttons and it also applies to other GUI elements.

You can create one by using new GUIStyle() but the prefered way is to use the GUIStyle.none static member. For example:

 GUI.Button(someRect, someText, GUIStyle.none);
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 ArtOfWarfare · Nov 08, 2014 at 08:41 PM 0
Share
  • for a great answer. From Dannysim's comment I knew to look in GUIStyle, and once I got there, after reading over the docs for several $$anonymous$$utes, I decided to try GUIStyle.none, and found it worked perfectly. If only your answer had been upvoted, I would have tried it and saved myself the trouble. I actually returned here with the plan of adding this answer, but then I saw your answer at the bottom, so I upvoted it, and I down voted jahroy. So now hopefully your answer, the best answer, will appear at the top. Edit: $$anonymous$$eh, it's the #2 answer after my votes. Still, as soon as one other person up votes this, it'll be #1.

avatar image
1

Answer by jahroy · Dec 06, 2011 at 10:25 PM

Like dannyskim says, take a look at GUIStyles to fully customize everything about your GUI elements.

You could also draw a button using the Label style like this:

/* get the label style from the current GUI skin */

var labelStyle : GUIStyle = GUI.skin.label;

GUI.Button(someRect, someText, labelStyle);

The default GUIStyle for labels has no frame or image associated with it.

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 ArtOfWarfare · Nov 08, 2014 at 08:43 PM 0
Share

-1: Just use GUIStyle.none as gaps says in their answer. This one just abuses the GUILabel's default style, which could theoretically someday change to include a border graphic.

avatar image
0

Answer by Ghnxyc · Jul 20, 2013 at 01:01 PM

Try putting this piece of code: GUI.backgroundColor = new Color(0,0,0,0); infront of your GUI.Button code.

for example:

 //back button
 GUI.backgroundColor = new Color(0,0,0,0);
 if(GUI.Button(new Rect(5*Screen.width/100-Screen.height/12, 44*Screen.height/50, Screen.height/8, Screen.height/8), BackButton))
         {
             /*go back;*/
         }

It worked for me.

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

6 People are following this question.

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

Related Questions

GUIStyle Border Pixels 0 Answers

Why can't I access the Name field in the Custom Styles section of a GUISkin in the Inspector? 2 Answers

Why is texture blurred in one GuiStyle and not in another? 1 Answer

Problems controlling the GUI skin / style 2 Answers

Understanding GUISkin/GUIStyle BackgroundImage and Border 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