I am trying to check if a variable has a TextArea attribute, but even if it does it still returns false.
What am I doing wrong here?
public class Product
{
[SerializeField] string ID;
[SerializeField] string Name;
[TextArea(4, 8)]
[SerializeField] string Description;
[SerializeField] double Price;
}
Product product;
public void GetProperties()
{
PropertyInfo[] properties = product.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
Debug.Log(Attribute.IsDefined(property, typeof(TextAreaAttribute)));
}
}
Aucun commentaire:
Enregistrer un commentaire