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 PaxStyle · Aug 20, 2013 at 08:34 PM · changeslider

Customize Slider

Hi to all! :) How can I customize the slider's default unity? with a my image..

I Mean this: http://img821.imageshack.us/img821/720/zae.png

Which part of code I should change? sorry but I'ma beginner.. :/

 function OnGUI () {
 
 if(slider >= 1.0)
 {
     slider = 0;
 }
 
 slider= GUI.HorizontalSlider( Rect(20,20,200,30), slider, 0,1.0);
 Hour= slider*24;
 Tod= slider2*24;
 sun.transform.localEulerAngles = Vector3((slider*360)-90, 0, 0);
 slider = slider +Time.deltaTime/speed;
 sun.color = Color.Lerp (SunNight, SunDay, slider*2);
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by TimBorquez · Aug 20, 2013 at 08:51 PM

well one way that i do custom GUI things is i make a gui style variable and then pass it into the gui i want,

so like make a stye variable:

 var customStyle : GUIStyle;

and then set up the style in the inspector (onhover and onclick and whatnot) and then pass that style into the slider (the style is usually at the end so it would be something like)

 slider= GUI.HorizontalSlider( Rect(20,20,200,30), slider, 0,1.0, customStyle);

and according to this you can pass a style in for both the slider and the little nub i believe

A different way would be to set up a custom skin and then in the ongui function set that skin,

hope that makes sense, and this is just how i do it there may be better ways...

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 Ejlersen · Aug 20, 2013 at 08:56 PM 0
Share

Guess you are the fastest gunman in Unity Answers ;)

avatar image TimBorquez · Aug 20, 2013 at 09:06 PM 0
Share

haha only right now cuz im trying to help some people, i answer far too little for how much i ask 0_0

avatar image PaxStyle · Aug 24, 2013 at 10:28 AM 0
Share

This give me an error..

var customStyle : GUIStyle;

 function OnGUI () {
 
 if(slider >= 1.0)
 {
     slider = 0;
 }
 
 slider= GUI.HorizontalSlider( Rect(20,20,200,30), slider, 0,1.0, customStyle);
 Hour= slider*24;
 Tod= slider2*24;
 sun.transform.localEulerAngles = Vector3((slider*360)-90, 0, 0);
 slider = slider +Time.deltaTime/speed;
 sun.color = Color.Lerp (SunNight, SunDay, slider*2);
 
avatar image
0

Answer by Ejlersen · Aug 20, 2013 at 08:52 PM

If you want to change its style, then you need to create a custom guistyle for it, or modify the existing one.

You can find it in:

  • GUI.skin.horizontalSlider

  • GUI.skin.horizontalSliderThumb

Or if you create your own, then you can use:

HorizontalSlider(Rect position, float value, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb);

Where you can specify your own two guistyles for the horizontal slider.

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

18 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

Related Questions

Horizontal Slider Normal-Background Change Color Independently 3 Answers

Change position - cameras - slider 1 Answer

using rgb to change color c# 1 Answer

Slider doesn't work on Android device 1 Answer

Character Interface Change (Help) 0 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