Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Multiple, connected sliders

Discussion in 'Scripting' started by khanstruct, Mar 31, 2015.

  1. khanstruct

    khanstruct

    Joined:
    Feb 11, 2011
    Posts:
    2,869
    I'm using sliders to increase/decrease my character's stats. So, I have 7 sliders and, ideally, I'd like them to use one script. However, in order to do that, I have to know which slider is changing.

    Is there some way to find the slider that is being changed? So, for example, if I'm adjusting the Strength slider, it changes the Strength attribute. Obviously, I can't have two arguments in the slider function, but as an example, I'd like to get something like this:
    Code (CSharp):
    1. public void ChangeStat(*Stat Being Changed*, float value)
    Or, do I have to have 7 different functions; one for each slider?