using UnityEngine;
namespace Plugins.Animate_UI_Materials
{
///
/// Used in with GraphicMaterialOverride to modify a material without creating a variant
/// Added to a child of the Graphic element
/// This variant only applies to Texture properties
///
[AddComponentMenu("UI/Animate UI Material/GraphicPropertyOverrideTexture")]
public class GraphicPropertyOverrideTexture : GraphicPropertyOverride
{
///
/// Apply the modified property to the material
///
///
public override void ApplyModifiedProperty(Material material)
{
material.SetTexture(PropertyId, propertyValue);
}
///
/// Retrieve the default Texture value from the source material
///
/// The source material
/// The Texture value from the material
/// True if the value could be retrieved
public override bool GetDefaultValue(Material material, out Texture defaultValue)
{
bool hasProperty = material.HasTexture(PropertyId);
if (hasProperty) defaultValue = material.GetTexture(PropertyId);
else defaultValue = default;
return hasProperty;
}
}
}