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