Font file not cache update please fix

Font file .Cache not updating due to unchanged file name or missing version parameter.

Hello oot4chi,

It appears that the issue with the font cache not updating is related to how the font files are managed in your project. To ensure proper cache updates, consider the following steps based on the provided code:

  1. Filename Changes: If the font file’s name does not change after updates, the cache might not recognize it as a new asset. Ensure to modify the filename if the font content changes.

  2. Version Parameters: If you are using a versioning system, add a version parameter to your font files. This allows you to append a version number to the filename, helping cache management recognize updates.

  3. Force Update: Implement functionality to force re-export the font. This can be done by setting the force parameter to true when calling the TryGenerateRuntimeFont method.

Here’s an example on how to modify the TryGenerateRuntimeFont call to force updates:

public static string TryGenerateRuntimeFont(Font font, FontStyle style, string targetDirectory, bool force = true, object owner = null)
{
    // Your implementation here...
}
  1. Clear Cache Method: Make sure to call the ClearCache method whenever you know that a font file has changed. This method clears out the existing cache, allowing for fresh entries.

The relevant code snippets indicate how paths and cache are being handled, and the logic checks for existing files before exporting.

If you need any specific help on implementation or these concepts, please let me know!

For further details, you might want to take a look at the documentation available at the Needle Engine Documentation.

Feel free to ask additional questions if needed!

1 replies left - Get a PRO license for more AI replies.
thread_x71hb9mpYZkdJJ2fRc4eSkBt
Reply to this message to continue the conversation