Give Page Feedback | API

Secondary Components - How To Create Custom SAM Sliders

Custom SAM Sliders can be used to display the Initialization Progress when using a SAMInitializer, in cases where you are not using a Unity UI Slider component.

Note that though this component is called SAMSlider, it is not strictly necessary to use a slider to display the Initialization Progress. That is just the most common means of doing so, hence the use of the name.

To start, create a new MonoBehaviour script that derives from the SAMSlider base abstract class.

You should place your class inside of the DeepSpaceLabs.SAM namespace, which will make the SAMSlider class available and also help avoid naming conflicts with 3rd party assets or your own code.

--Special Note--
An easy way to start with your custom class is to hover over your custom class name and choose the option Show potential fixes -> Implement abstract class. This will provide default overrides for all abstract class members.

In addition, we recommend adding the following attribute above your class, which will ensure the custom SAMSlider is shown with other SAMSliders in menus:

[AddComponentMenu(GlobalValues.COMPONENT_ROOT_PATH + "Secondary Components/Custom SAM Slider Name")]

SetSliderValue (Method - Implementation Required)

Override to provide the logic for setting some UI element to the passed in slider value.

The value passed in is always a float between 0f and 1f, marking the progress of the Initialization.