Introduction

Version 4.0.0 and later of the Zendesk SDK for Unity introduces a system for font management. This change gives you more control over your application's size and appearance.

  • Modular Font Packages: The core SDK is now separate from language-specific font packages.
  • Reduced SDK Size: This approach significantly reduces the SDK's footprint in your project, as you only need to include the fonts for the languages you support.
  • Enhanced Flexibility: Customize fonts easily without altering the core SDK package.

How font installation works

When the SDK is first imported into a project, it automatically performs the following actions:

  1. Creates a Fonts directory at Assets/Zendesk/Resources/Fonts/.
  2. Copies the default font, Roboto-Regular SDF.asset, to this directory.
  3. Creates and configures a ZMFontReference.asset in the same location.

This process ensures that all text components within the SDK have a consistent and correctly configured font reference. The installer does not overwrite existing files, preserving any customizations you have made.

Installing language font packs

To add support for languages not covered by the default font, you must install the appropriate language font pack.

Adding a scoped registry

In the Unity Editor, click Project Settings > Package Manager and expand the Scoped Registries group.

Enter the following registry details and click Save.

Name: ZendeskURL: https://zendesk.jfrog.io/artifactory/api/npm/unity-sdkScopes: com.zendesk.messaging

Installing the language fonts

In the Unity Editor, open the Package Manager by clicking Window > Package Manager. In the Package Manager window, find the package you require by name.

Available packs include:

  • com.zendesk.messaging.plugin.font-chinese-simplified
  • com.zendesk.messaging.plugin.font-chinese-traditional
  • com.zendesk.messaging.plugin.font-japanese
  • com.zendesk.messaging.plugin.font-korean
  • com.zendesk.messaging.plugin.font-thai

Each font package automatically finds all included font assets in its Fonts directory and registers them as fallbacks to your main font in ZMFontReference.asset.

Using installed fonts

For the SDK to render characters from a language pack, you must specify the target language during initialization.

var result = await ZendeskSdk.InitializeAsync(opt =>{    opt.ChannelId = "YOUR_CHANNEL_ID";    opt.Language = ZendeskLanguage.Japanese;});

Customizing fonts

Two primary methods for font customization are supported:

Replacing the default font

  1. Navigate to Assets/Zendesk/Resources/Fonts in the Project window.
  2. Select the ZMFontReference.asset.
  3. In the Inspector, replace the main font with your own TMP_FontAsset.

All Zendesk UI text elements will update automatically to use the font.

Modifying fallback fonts

  1. Select the ZMFontReference.asset located at Assets/Zendesk/Resources/Fonts.
  2. In the Inspector, expand the Fallback Font Assets list.
  3. Add, remove, or reorder fonts as needed.

Creating a custom font asset

The Zendesk SDK uses TextMesh Pro for all text rendering. To use a custom font, you must first convert it into a TMP_FontAsset.

  1. Import your desired font file (for example, a .ttf or .otf file) into your Unity project.
  2. Select the font file in the Project window.
  3. Navigate to Window > TextMeshPro > Font Asset Creator.
  4. Configure the settings, such as character sets and atlas resolution, to meet your needs.
  5. Click Generate Font Atlas and save the TMP_FontAsset.

You can now use this generated asset to replace the default font.

Troubleshooting

Characters appear as squares or question marks

This issue, often called "tofu," occurs when the font in use does not contain the glyphs for the characters being displayed.

  • Verify Language Pack Installation: Ensure you have installed the correct font package for the language you are trying to display.
  • Check Initialization: Confirm that you are setting the correct ZendeskLanguage during SDK initialization.