Class MsdfEditorUtils
[PublicAPI]
public static class MsdfEditorUtils
- Inheritance
-
MsdfEditorUtils
- Inherited Members
Methods
DrawDistanceField(MaterialEditor, MaterialProperty, MaterialProperty)
Draws a distance field property.
public static void DrawDistanceField(this MaterialEditor editor, MaterialProperty distanceField, MaterialProperty pixelRange = null)
Parameters
editorMaterialEditordistanceFieldMaterialPropertypixelRangeMaterialProperty
DrawDistanceFieldPropertyNamePicker(SerializedProperty, Func<Object, IEnumerable<Material>>)
Draws a dropdown listing every texture property name that follows the conventions for a distance field in the given materials.
public static void DrawDistanceFieldPropertyNamePicker(SerializedProperty fieldPropertyName, Func<Object, IEnumerable<Material>> getMaterials)
Parameters
fieldPropertyNameSerializedPropertyString property to store the result in.
getMaterialsFunc<Object, IEnumerable<Material>>Called for each target object, returns each material to be searched.
DrawPerspectiveAwarePixelRange(MaterialEditor, MaterialProperty)
Draws the Perspective-aware toggle.
public static void DrawPerspectiveAwarePixelRange(this MaterialEditor editor, MaterialProperty perspectiveAware)
Parameters
editorMaterialEditorEditor to draw the property in.
perspectiveAwareMaterialPropertyThe PerspectiveAwarePixelRangeKeyword property.
DrawPixelRangeSource(MaterialEditor, MaterialProperty)
Draws the source properties as dropdowns.
public static void DrawPixelRangeSource(this MaterialEditor editor, MaterialProperty pixelRangeSource)
Parameters
editorMaterialEditorThe editor to draw them in.
pixelRangeSourceMaterialPropertyThe PixelRangeSourceKeywordPrefix property.
GetAssetFor(Texture)
Returns the UnityEngine.Sprite associated with this texture, if any.
public static Sprite GetAssetFor(Texture texture)
Parameters
textureTexture
Returns
- Sprite
TakeDistanceField(IDictionary<string, MaterialProperty>, string)
Removes the field texture property and its corresponding pixel range property from the dictionary, only if both exist.
public static (MaterialProperty Field, MaterialProperty PixelRange)? TakeDistanceField(IDictionary<string, MaterialProperty> unhandledProperties, string fieldName)
Parameters
unhandledPropertiesIDictionary<string, MaterialProperty>The SetupScopes(IDictionary<string, MaterialProperty>) parameter.
fieldNamestringName of the distance field to take.
Returns
- (MaterialProperty Field, MaterialProperty PixelRange)?
A tuple containing the field and its pixel range, or null if either property was not available.