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 aeronav1 · May 20, 2017 at 08:49 AM · guiguitexturesliderongui

How do I customize or reshape GUI vertical slider?

I have a vertical slider which acts as throttle control, I have a couple persisting issues with it I've been trying to solve, I tried many things but I couldn't solve them :

  1. Throttle (thumb) starts at half position not all the way down.

2.Slider color is black (or gray) which is sometimes invisible when the scene is a night scene.

with these two major issues i've been thinking about using a texture as a slider, maybe trying to integrate the slider with a more proffesional looking throttle control, but then I will have a problem moving the Texture and/or getting values from it, right now, if i can make it go all the way down and change its' color, that would be good. My current slider setting code:

 GUIStyle mySliderStyle = new GUIStyle(GUI.skin.verticalSlider);
 GUIStyle myThumbStyle = new GUIStyle(GUI.skin.verticalSlider);
 mySliderStyle.fixedWidth = 30;
 mySliderStyle.fixedHeight = 100;
 mySliderStyle.normal.textColor = Color.red;  //this line is useless (it doesn't change slider color because there is no text in slider)
 myThumbStyle.fixedWidth = 77;
 myThumbStyle.fixedHeight = 10;
 vSliderValue = GUI.VerticalSlider(new Rect(20,Screen.height / 2 - 6,100,50), vSliderValue, 10.0F, 0.0F, mySliderStyle,myThumbStyle);

This is what the slider look like now:

alt text

As I mentioned, you can see that throttle starts at Half with value of zero and it wouldn't go all the way down, and then all the way to the top is value 10, which is not right (should be zero at bottom, and 10 at top, and 5 at half).

I can not use GUI.backgroundColor because the slider is not the only element in the OnGUI function, so I don't want to effect other GUI elements, Also when I tried using it, it did not change the slider color anyways, so I thought this is not what I need. I thought of workarounds but non were practical, any ideas, suggestions?

Thank you.

vslider.png (19.3 kB)
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

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Animated GUITexture based on Sprite Sheet? 0 Answers

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

OnGUI vs GUITexture for Tablets and Phones 2 Answers

Slider & Button Interaction Problem 0 Answers

Long press on EXISTED GUITexture 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