Give Page Feedback | API

Secondary Components - How To Create Custom SAM Texts

Custom SAM Texts can be used to display the Initialization Progress Text when using a SAMInitializer, in cases where you are not using a Unity UI Text, TextMeshPro, or TextMeshProUGUI component.

The text passed into the SetText method is pre-formatted according to the Progress Text Format string on the SAMInitializer. You should use that format field to make the text appear exactly as you want, then simply set your UI Text to the value passed into the SetText method.

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

You should place your class inside of the DeepSpaceLabs.SAM namespace, which will make the SAMText 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 SAMText is shown with other SAMTexts in menus:

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

SetText (Method - Implementation Required)

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