MainToolbarSlider
A slider element for the main toolbar.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Class
- Namespace: UnityEditor.Toolbars
- Assembly: UnityEditor
- Inherits from: MainToolbarElement
public sealed class MainToolbarSlider : MainToolbarElement
Remarks
Return an instance of this class through a static method registered with MainToolbarElementAttribute to add a slider element in the main toolbar.
Examples
using UnityEditor;using UnityEditor.Toolbars;using UnityEngine;public class MainToolbarSliderExample{ const float k_MinTimeScale = 0f; const float k_MaxTimeScale = 10f; [MainToolbarElement("Examples/Slider", defaultDockPosition = MainToolbarDockPosition.Middle)] public static MainToolbarElement TimeSlider() { var content = new MainToolbarContent("Time Scale", "Time Scale"); return new MainToolbarSlider(content, Time.timeScale, k_MinTimeScale, k_MaxTimeScale, OnSliderValueChanged); } static void OnSliderValueChanged(float newValue) { Time.timeScale = newValue; }}
Constructors
Constructor | Description |
|---|---|
| MainToolbarSlider(UnityEditor.Toolbars.MainToolbarContent,System.Single,System.Single,System.Single,System.Action{System.Single}) | Specify the content and function of a main toolbar slider. |
| MainToolbarSlider(UnityEditor.Toolbars.MainToolbarContent,System.Single,System.Single,System.Single,System.Action{System.Single},System.Boolean) | Specify the content and function of a main toolbar slider. |