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
editor
MaterialEditordistanceField
MaterialPropertypixelRange
MaterialProperty
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
fieldPropertyName
SerializedPropertyString property to store the result in.
getMaterials
Func<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
editor
MaterialEditorEditor to draw the property in.
perspectiveAware
MaterialPropertyThe PerspectiveAwarePixelRangeKeyword property.
DrawPixelRangeSource(MaterialEditor, MaterialProperty)
Draws the source properties as dropdowns.
public static void DrawPixelRangeSource(this MaterialEditor editor, MaterialProperty pixelRangeSource)
Parameters
editor
MaterialEditorThe editor to draw them in.
pixelRangeSource
MaterialPropertyThe PixelRangeSourceKeywordPrefix property.
GetAssetFor(Texture)
Returns the UnityEngine.Sprite associated with this texture, if any.
public static Sprite GetAssetFor(Texture texture)
Parameters
texture
Texture
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
unhandledProperties
IDictionary<string, MaterialProperty>The SetupScopes(IDictionary<string, MaterialProperty>) parameter.
fieldName
stringName 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.