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 thelebaron · Jun 21, 2018 at 12:31 AM · guistyleguistyles

What is the name of the GUIStyle that controls this GUIStyle enum effect?

https://gfycat.com/UnlinedGlitteringAldabratortoise - (Visual example of what Im talking about, I want to change the 3d effect to a flat color, to match the rest of the ui.)

I have a small custom editor that draws this ui, what is bugging me is I cant seem to find the guistyle to control the 3d effect on the enum. Ive changed normal,onnormal,active,onactive,focused,onfocused,hover,onhover but none of them seem to have an effect for this particular effect.

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 Bunny83 · Jun 21, 2018 at 12:39 AM 0
Share

Sorry but it's not clear what you actually talk about. Which control do you mean? We can't tell what's an enum and what's just a button. Also you have to show your code of the relevant control. Each control usually has it's own style and some controls have several styles.

avatar image thelebaron Bunny83 · Jun 21, 2018 at 01:10 AM 0
Share

Sorry let me try again - Theres an enum dropdown box that I'm clicking on in the gif link. I want to change part of its visual effect.

  • By default unity renders buttons with a slight 3d effect.

  • Ive used GUIStyle.normal.background to change this default effect for buttons and enums (as well as active, hover, focus and their "on" equivalents)

  • I wasnt entirely successful though, there is still a default 3d effect that lingers after an enum has been clicked. When you click away from it, it returns to the custom look. How do I change this, what part of GUIStyle addresses this?

1 Reply

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

Answer by Bunny83 · Jun 21, 2018 at 10:02 AM

Ok so i guess you use the EditorGUI.EnumPopup control in your code? In this case it only uses the 4 none "on" states: "normal", "hover", "focused" and "active". Just have a look at the actual implementation of the underlying method. As you can see in line 2855 they pass false to the "on" parameter. The style state that you're looking for is most likely "focused" as this style is used when the drawn control has the keyboard focus. The focus is determined by GUIUtility.keyboardControl and the passed controlID.


You may want to have a look at my IMGUI crash course, specifically at the GUIStyle section. Unfortunately since UnityAnswers messed up it's content renderer the post looks smashed together as paragraphs are now ignored and bulletpoint lists are no longer indented.


Fact is Unity doesn't render anything else for a GUIStyle. The GUIStyle is completely responsible for how it looks like on the screen. You said you set / replaced the focused state, but that's can't be true in your case. If you need / want any further help with this, again, post your code and how and where you create your GUIStyle. Keep in mind that creating a GUISin is usually the cleanest way to setup your own styles.

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

84 People are following this question.

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

Related Questions

copy a GUIStyle into a new GUIStyle var using JavaScript 2 Answers

Remove Button Border 3 Answers

Variable from String 0 Answers

GUI works fine in editor, but not in build 2 Answers

GUI custom textfield cursor rendering 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