Hello,
It should be as easy as doing this:
// With the icon name
m_VectorImage.SetImage(MaterialIconHelper.GetIcon("exact_name_of_the_icon"));
// Using the enum
m_VectorImage.SetImage(vectorImageData = MaterialIconHelper.GetIcon(MaterialIconEnum.CONTACT_PHONE));
// Random icon
m_VectorImage.SetImage(vectorImageData = MaterialIconHelper.GetRandomIcon());
I've just added that in the Vector Images example scene (#10), it will be available with the next update ;)
------------------------------------------------------------------------------------------------------------
If you want to set an icon from a different set than the Material Design Icons, just use the method below (here's an example using the FontAwesome Icon Font):
m_VectorImage.SetImage(GetIconFromIconFont("FontAwesome", "gift"));
private ImageData GetIconFromIconFont(string fontName, string iconName)
{
VectorImageSet iconSet = VectorImageManager.GetIconSet(fontName);
Glyph glyph = iconSet.iconGlyphList.Where(x => x.name.ToLower().Equals(iconName.ToLower())).FirstOrDefault();
if (glyph == null)
{
Debug.LogError("Could not find an icon with the name: " + iconName + " inside the " + fontName + " icon font");
return null;
}
Font font = VectorImageManager.GetIconFont(fontName);
return new ImageData(new VectorImageData(glyph, font));
}
~ Yohan