-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from Tryibion/slider-docs
Add slider docs
- Loading branch information
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Slider | ||
|
||
![Slider](media/slider.png) | ||
|
||
The **Slider** responds to a value changed event from the user to change a value. | ||
|
||
# Usage | ||
|
||
Here is a c# example of how to get and use a slider's `ValueChanged` event in a script: | ||
|
||
```cs | ||
public UIControl SliderUIControl; | ||
private Slider _slider; | ||
|
||
public override void OnStart() | ||
{ | ||
if (SliderUIControl) | ||
_slider = SliderUIControl.Get<Slider>(); | ||
if (_slider != null) | ||
_slider.ValueChanged += OnValueChanged; | ||
} | ||
|
||
private void OnValueChanged() | ||
{ | ||
Debug.Log($"Slider Value changed to {_slider.Value}"); | ||
} | ||
|
||
public override void OnDestroy() | ||
{ | ||
if (_slider != null) | ||
_slider.ValueChanged -= OnValueChanged; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters