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 Int properties
///
[AddComponentMenu("UI/Animate UI Material/GraphicPropertyOverrideInt")]
public class GraphicPropertyOverrideInt : GraphicPropertyOverride
{
///
/// Apply the modified property to the material
///
///
public override void ApplyModifiedProperty(Material material)
{
material.SetInteger(PropertyId, propertyValue);
}
///
/// Retrieve the default int value from the source material
///
/// The source material
/// The int value from the material
/// True if the value could be retrieved
public override bool GetDefaultValue(Material material, out int defaultValue)
{
bool hasProperty = material.HasInteger(PropertyId);
if (hasProperty) defaultValue = material.GetInteger(PropertyId);
else defaultValue = default;
return hasProperty;
}
}
}