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
1
Question by hijinxbassist · Apr 16, 2012 at 06:02 PM · guicolorsliderskin

Change Slider Color and add a custom Slider icon

How do you change the color of the GUI Slider. I am using the horizontal slider. I added a style, but i would like the slider itself to be a different color other than grey.

Also, is it possible to change the little box that you slide back and forth to a different thing? I figure placing a 2D texture plane over the position and referencing the value for screen coordinates. Havent tried it yet, maybe there is a better way of approaching this?

Thanks

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

1 Reply

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

Answer by Bunny83 · Apr 16, 2012 at 06:10 PM

You should create your own GUISkin and use it like this in OnGUI:

 //C#
 public GUISkin mySkin; // assign your skin in the inspector
 
 void OnGUI()
 {
     GUI.skin = mySkin;
     // [...]
 }

You can change the default styles of each control. A slider uses multiple styles, just check them out.

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 hijinxbassist · Apr 16, 2012 at 06:27 PM 0
Share

@Bunny83 Is the thumb the little box that slides? If i add a texture, does the texture override the box/thumb or does it "Style" the box/thumb using the texture.

avatar image Bunny83 · Apr 16, 2012 at 07:20 PM 0
Share

Yes the thumb is the slider handle. When you set a different texture it does replace the old one. The whole GUI controls are made of these styles. If you remove all textures from all styles it wouldn't display anything (besides the text). Buttons, windows, whatever, all consists of a GUIStyle. If you're new to the GUIStyle concept it might take a while until you figured out all possibilities, but it's really powerful.

When you create a new GUISkin it get initialized with the (internal) default runtime skin. Just explore the skin to get behind the concept.

Just as a hint: You can edit the GUISkin at runtime so you see realtime results. Quite handy when you want to configure the border(part of the texture that isn't scaled) of a button or window.

avatar image hijinxbassist · Apr 17, 2012 at 12:21 AM 0
Share

@Bunny83 Awesome, thanks a lot! I am new to GUI Skin, guess its time to dive in. Thanks again for your answer.

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

Guiskin: how to change font color? 0 Answers

Drawing 4 GUIButton's with a forloop. Need help changing color? 1 Answer

GUI Skin Custom textures in C# 2 Answers

How to render a colored 2D rectangle. 6 Answers

unity make a skin/texture to a character like the robot from the fps tutorial 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