How to create a Better UI Material
How to prepare the shader
If you need a custom shader and want to use it the same way as the predefined materials, you should start by copying the Standard.shader from "Assets/TheraBytes/BetterUI/Runtime/Resources/Materials" and modify the copy.
Please note that you can have a maximum of 3 float parameters for your shader (in addition to the default stuff like Color).
As mentioned in About Materials your parameters can be the x and/or y value of TEXCOORD1 as well as the w value of TANGENT semantics in the appdata_t struct (check out the HueSaturationBrightness shader to see how it is used there).
How to add it to the drop down
Create a material from your shader, then open the Material Definitions and do the following:
- Increase the Size of Materials by one.
- Expand the last material definition
- Give it a Name in the Name filed (This name will be displayed in the Image’s dropdown)
- Drag and Drop your Material in the Material field
- Expand Properties and Float Properties
- Insert the number of smart Properties in the Size field (maximum: 3)
- For each Property Field do the following:
- Enter the Name of the Property in the Name field (Label for the Property in the Image Inspector)
- Enter the default value in the Value field
- Select the Vertex variable where this property maps to in the Property Map dropdown
- If you want to display a slider in the Image Inspector for the property, you can define the Min and Max values in the respective fields. If Max is smaller or equal Min, any number can be chosen without a slider.