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 JojoJonas · Apr 21, 2012 at 07:02 AM · guiwindowactive

GUI Window remove white border from active window

Well, the title pretty much says it. How do I remove that annoying white border from the focused window in GUI.Window()?

I tried calling GUI.UnfocusWindows(), but that seems to mess lots of things up.

Comment
Add comment · Show 3
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 Fabkins · Apr 21, 2012 at 09:04 AM 0
Share

Yes it's annoying. Other trying to unfocus (which I've not had any success with), you can modify the GUI style so that it there isn't an onHover and onFocus graphic.

Now the reason this isn't in the answer column is although it ought to work I personally cannot get it working. I am totally confident that this the right approach I just can't seem to do it right.

Here is my post on the topic. http://answers.unity3d.com/questions/240382/problems-controlling-the-gui-skin-style.html

If you work out exactly how to clone the skin or modify the built in GUI skin so the style behaves correctly please post the code here and put me out of my misery.

avatar image JojoJonas · Apr 21, 2012 at 02:56 PM 0
Share

What worked for me was (for whatever reason) GUIStyle.onNormal. I posted on your thread as well

avatar image Fabkins · Apr 21, 2012 at 03:09 PM 0
Share

Yes, I tried but as I said it didnt work. What you suggested makes total sense its probably just a coding error on my part. What does you code look like?

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Lttldude · Apr 21, 2012 at 03:14 PM

I think I may have a solution. Correct me if I misunderstand the problem.

1) download and import the builtin GUI skin package

2) Create a new GUISkin

3) In the new skin, change the onNormal background for the window to the "window" texture under the imported assets (BuiltIn Skin/Sources/). This will make the onfocus window look like the unfocused window.

4) add skin to script:

 var windowFixSkin : GUISkin;
 
 function OnGUI()
 {
     //change the GUI Skin
     GUI.skin = windowFixSkin;
 
     //[THE GUI WINDOW]
 
     //change the GUI skin back to what it was, or to default with null value
     GUI.skin = null;    
 }

Hope this helps. Good luck.

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

Answer by Fabkins · Apr 21, 2012 at 03:20 PM

Ok, I messed about for 10 mins until I worked out which it was. Here this will do what you need:

      GUI.skin.GetStyle("Button").onActive.background=GUI.skin.GetStyle("Button").onNormal.background;
     GUI.skin.GetStyle("Button").active.background=GUI.skin.GetStyle("Button").normal.background;
     GUI.skin.GetStyle("Button").hover.background=GUI.skin.GetStyle("Button").normal.background;
     GUI.skin.GetStyle("Button").onHover.background=GUI.skin.GetStyle("Button").normal.background;


This gets rid of the white border on all conditions I can find.

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 JojoJonas · Apr 21, 2012 at 03:43 PM 0
Share

Yeah, that's pretty much exactly what I did, ha! I said that in my post to your thread (whenever it shows up), I just didn't notice those four members doing anything for GUI.Window.

It is apparently different for GUI.Button, as GUIStyle.onNormal doesn't seem to affect anything there. Thanks for the help!

avatar image
0

Answer by slippdouglas · Mar 21, 2014 at 08:01 AM

Sanest, simplest solution I've been able to work out:

In the class that wishes to draw the non-bordered window:

 static GUIStyle _NonSelectableWindowStyle;
 static GUIStyle NonSelectableWindowStyle {
     get {
         if (_NonSelectableWindowStyle == null) {
             GUIStyle s = new GUIStyle(GUI.skin.window);
             s.onNormal.background = null;
             _NonSelectableWindowStyle = s;
         }
         return _NonSelectableWindowStyle;
     }
 }

And then the GUI/GUILayout.Window call:

 void OnGUI()
 {
     GUILayout.Window(
         id: this.windowID,
         screenRect: this.menuRect,
         func: DrawMenuContents,
         text: this.menuTitle,
         style: NonSelectableWindowStyle, // <-- notice!
         GUILayout.Width(MenuWindowWidth), GUILayout.ExpandHeight(true)
     );
 }

Good C# coding practices included just because I love you all.  And I'm a little drunk.

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

ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint 0 Answers

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

GUI.Window error. InvalidOperationException: Hashtable.Enumerator: snapshot out of sync. 0 Answers

Are dockable windows possible in-game. 2 Answers

Close (X) button 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