Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

gui question

Discussion in 'Immediate Mode GUI (IMGUI)' started by User340, Nov 1, 2007.

  1. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Could someone give a small example on how to make a simple gui horizontal slider. I can't get it to work. Here's what I tried:

    Code (csharp):
    1. var value = 1.0;
    2. var minValue = 0.0;
    3. var maxValue = 3.0;
    4.  
    5. function OnGUI ()
    6. {
    7.     GUI.HorizontalSlider (Rect (20, 20, 300, 30), value, minValue, maxValue);
    8. }
    Do I have to make the value variable equal to the mouse position, or something?

    Thanks
     
  2. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    There's actually a demo of an RGB slider in the compound components section of the Unity doco IIRC
    cheers
    Shaun
     
  3. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    thanks