Skip to content
Falko edited this page Nov 16, 2023 · 2 revisions

If you want to use icons within SEE, you can use any of the (free) icons from FontAwesome v6.

Displaying an icon

To display an icon in SEE, add a TextMeshPro component to the object where you want to display the icon. Use the UI variant of the TextMeshPro component if you want to display it in screen space (i.e., on the 2D canvas). In the new component, set the font to the "Font Awesome 6 Free" font.

image

Choosing an icon

First, look at the Utils/Icons.cs class and see if there is an icon name that sounds fitting for your use case. If there is, continue at "Setting the icon via code". If there is no fitting icon, or you need to set the icon within the editor and not the code, continue below.

If not, go to the FontAwesome v6 site and choose any icon you like that does not have the "Pro" badge next to it. Once you have found an icon, click on it.

image

Now, what you need to do depends on whether you want to set the icon statically (in the editor) or dynamically (in the code):

  • Setting the icon via the editor: In the upper right corner of the page, click on the Glyph to copy it to your clipboard. Then, in the Unity editor, simply paste it into the TextMeshPro component's "Text Input" field.
  • Setting the icon via code: In the upper right corner, look for the Unicode field to find the hexadecimal code (you can also click on it to copy it to your clipboard). In C#, you can represent the icon as a character by doing char icon = '\uF05A'; (for hexadecimal code f05a). You can use the same syntax in a string. Add a new entry to Utils/Icons.cs for your icon, e.g.:
public const char Info = '\uF05A';

Then, setting the icon in the TextMeshPro might look like this:

gameObject.MustGetComponent<TextMeshProUGUI>().text = $"{Icons.Info}";
Clone this wiki locally