1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to control three slider values using one slider

Discussion in 'Programming/Internet' started by TenOutOfTen, Oct 8, 2018.

  1. TenOutOfTen

    TenOutOfTen Guest

    I have 3 sliders with the following ranges respectively [-12, 12], [-42, 42], [-61, 61] in my editor code, with each set to the following values —4, 18 and 30. How can I set a new slider (from 0 to 1) that controls the movement of each of the three slider values from their original value, to the negative of their original value? I.e -4 moves to 4 for slider 1, 18 moves to -18 for slider 2 and 30 moves to -30 for slider 3 all controlled by one one slider with range [0, 1]. Below is slider1’s code in OnInspectorGUI(), the rest are very similar:

    dist = EditorGUILayout.Slider(“Slider 1”, sprite.originalDist, -12.0f, 12.0f);
    if (!Mathf.Approximately(sprite.originalDist, dist))
    {
    sprite.PrepareDist(first, dist);
    sprite.originalDist = dist;
    }

    Login To add answer/comment
     

Share This Page