Unity fails to create font for UI

In one of my projects I explore the “Screenspace UI” sample. But when I want to test it as local export or real build all fonts are missing.

The Unity shows these warning and errors:

"
Font texture for RobotoSlab-Regular is generated with dynamic set - this may lead to fonts having only the characters currently used in your project. If you want to provide dynamic text support you should change this setting in your font asset
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
Needle.Engine.Utils.FontsHelper:InternalGenerateRuntimeFont (UnityEngine.Font,UnityEngine.FontStyle,string,bool&,bool,object) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Utils/FontsHelper.cs:168)
Needle.Engine.Utils.FontsHelper:TryGenerateRuntimeFont (UnityEngine.Font,UnityEngine.FontStyle,string,bool,object) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Utils/FontsHelper.cs:34)
Needle.Engine.Gltf.GltfValueResolver:TryGetValue (Needle.Engine.IExportContext,object,System.Reflection.MemberInfo,object&) (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/GltfValueResolver.cs:190)
Needle.Engine.Serialization.WrappedValueResolver:GetValue (object) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Serialization/NeedleContractResolver.cs:244)
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter:CalculatePropertyValues (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract&,object&)
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter:SerializeObject (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonObjectContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty)
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter:SerializeValue (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty)
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter:Serialize (Newtonsoft.Json.JsonWriter,object,System.Type)
Newtonsoft.Json.JsonSerializer:SerializeInternal (Newtonsoft.Json.JsonWriter,object,System.Type)
Newtonsoft.Json.JsonSerializer:Serialize (Newtonsoft.Json.JsonWriter,object,System.Type)
Newtonsoft.Json.JsonConvert:SerializeObjectInternal (object,System.Type,Newtonsoft.Json.JsonSerializer)
Newtonsoft.Json.JsonConvert:SerializeObject (object,System.Type,Newtonsoft.Json.Formatting,Newtonsoft.Json.JsonSerializerSettings)
Newtonsoft.Json.JsonConvert:SerializeObject (object,Newtonsoft.Json.Formatting,Newtonsoft.Json.JsonSerializerSettings)
Needle.Engine.Serialization.NewtonsoftSerializer:Serialize (object) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Serialization/NewtonsoftSerializer.cs:21)
Needle.Engine.Gltf.UnityGltf.UnityGltf_NEEDLE_components_Extension:InternalSerialize (Needle.Engine.IExportContext,Needle.Engine.IGuidProvider,Needle.Engine.IValueResolver,System.Collections.Generic.IList1<UnityEngine.Component>) (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/UnityGltf/UnityGltf_NEEDLE_components_Extension.cs:93) Needle.Engine.Gltf.UnityGltf.UnityGltf_NEEDLE_components_Extension:OnAfterExport () (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/UnityGltf/UnityGltf_NEEDLE_components_Extension.cs:44) Needle.Engine.Gltf.UnityGltf.UnityGltfComponentHandler:OnAfterExport (Needle.Engine.Gltf.GltfExportContext) (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/UnityGltf/UnityGltfComponentHandler.cs:72) Needle.Engine.Gltf.UnityGltf.UnityGltfExportHandler:OnAfterExport (UnityGLTF.GLTFSceneExporter,GLTF.Schema.GLTFRoot) (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/UnityGltf/UnityGltfExporter.cs:332) UnityGLTF.ExportContext/ExportContextCallbacks:AfterSceneExport (UnityGLTF.GLTFSceneExporter,GLTF.Schema.GLTFRoot) (at ./Library/PackageCache/org.khronos.unitygltf/Runtime/Scripts/GLTFSceneExporter.cs:70) UnityGLTF.GLTFSceneExporter:SaveGLBToStream (System.IO.Stream,string) (at ./Library/PackageCache/org.khronos.unitygltf/Runtime/Scripts/GLTFSceneExporter.cs:749) UnityGLTF.GLTFSceneExporter:SaveGLB (string,string) (at ./Library/PackageCache/org.khronos.unitygltf/Runtime/Scripts/GLTFSceneExporter.cs:684) Needle.Engine.Utils.ExportUtils:ExportWithUnityGltf (UnityGLTF.GLTFSceneExporter,string,bool) (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ExportUtils.cs:37) Needle.Engine.Gltf.UnityGltf.UnityGltfExportHandler:OnExport (UnityEngine.Transform,string,Needle.Engine.IExportContext) (at ./Library/PackageCache/com.needle.engine-exporter/Gltf/Editor/UnityGltf/UnityGltfExporter.cs:170) Needle.Engine.Components.GltfObject:Export (string,bool,Needle.Engine.IExportContext) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Runtime/Components/Export/GltfObject.cs:81) Needle.Engine.Core.Emitter.GltfEmitter:Run (UnityEngine.Component,Needle.Engine.Core.ExportContext) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Emitter/GltfEmitter.cs:92) Needle.Engine.Core.Builder:ExportComponent (UnityEngine.GameObject,UnityEngine.Component,Needle.Engine.Core.ExportContext,Needle.Engine.Interfaces.IEmitter) (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:743) Needle.Engine.Core.Builder/<Traverse>d__39:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:709) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:Start<Needle.Engine.Core.Builder/d__39> (Needle.Engine.Core.Builder/d__39&)
Needle.Engine.Core.Builder:Traverse (UnityEngine.GameObject,Needle.Engine.Core.ExportContext,Needle.Engine.Interfaces.IEmitter)
Needle.Engine.Core.Builder/d__37:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Core/Builder.cs:680)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

Error: Cannot find module ‘@jimp/jpeg’

Error: Cannot find module ‘@jimp/jpeg’

Failed to generate font files for RobotoSlab-Regular
UnityEngine.Debug:LogError (object)
Needle.Engine.Utils.FontsHelper/d__11:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Utils/FontsHelper.cs:323)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult (bool)
Needle.Engine.Utils.ProcessHelper/d__4:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:274)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

Failed to generate font files for Arial
UnityEngine.Debug:LogError (object)
Needle.Engine.Utils.FontsHelper/d__11:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Core/Editor/Utils/FontsHelper.cs:323)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult (bool)
Needle.Engine.Utils.ProcessHelper/d__4:MoveNext () (at ./Library/PackageCache/com.needle.engine-exporter/Common/Runtime/Utils/ProcessHelper.cs:274)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

WARN: Could not validate image type for “image/exr”
"

The interesting thing is. I have the problem only on my Office-PC, but NOT on my HomeOffce-PC.
Both share the same project via repository. Same version of tools. Node.js and ktx same. I even copy the full Unity Library from my HomeOffice-PC (Where it’s fine) to my Office-PC without success.

Any ideas where the problem could be?

Hello! It seems you’re encountering issues with font generation during your Unity project build. The warning indicates that the RobotoSlab-Regular font is being generated in a dynamic way, which can lead to missing characters if not configured properly.

Here’s a detailed plan to address this:

  1. Inspect Font Asset Settings:

    • Open your font asset in Unity.
    • Look for settings like “Dynamic” or “Static”. If it’s set to Dynamic, switch it to Static to ensure all characters are included.
  2. Include Complete Character Set:

    • If you require dynamic text support (like text that changes during runtime), you might want to confirm that you’re including the character set you need.
    • In the font asset settings, there should be an option to define the character set. Ensure it includes all characters you plan to use.
  3. Regenerate Font Assets:

    • After adjusting the settings, regenerate the font asset and test the export/build process again.
  4. Check Build Environment:

    • Make sure that your build settings are correct and that the fonts are included in the build.
  5. Monitor Logs:

    • Keep an eye on the console logs for any remaining issues or warnings during the build process.

If you apply these adjustments and still encounter problems, please let me know the specific version of Unity you are using and whether you’re seeing any additional warnings or errors. This will help further diagnose the issue.

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

The RobotoSlab-Regular font is Dynamic in the Sample which is write protected as default.
But it doesn’t explain why one Computer can build it with Dynamic and the other not.

Hi! It sounds like you’re dealing with a compatibility or configuration issue between the two computers. Here are some potential reasons for the different behaviors when building the project:

  1. Unity Version Difference:

    • Check if both computers are running the exact same Unity version. Slight differences in versions may lead to changes in how fonts are handled.
  2. Font File Access:

    • Ensure that the font file itself on both computers is identical and accessible. There could be differences in the location or file permissions that could affect the build.
  3. Project Settings:

    • Compare the project settings between the two environments. Specifically, look at the Player settings, Graphics settings, and any settings related to fonts and text rendering.
  4. Package Version:

    • Verify if both setups have the same version of the Needle Engine and related packages. Different versions may have bugs or features affecting font handling.
  5. Font Management:

    • Check if there are any additional font management tools or settings installed on one of the computers that might affect how fonts are loaded or built.
  6. Build Configuration:

    • Confirm that both computers are using the same build configuration (Development vs. Release) and target platform.

If the issue persists, it might be helpful to perform a clean import of the project on the problematic computer or inspect any logs for additional clues. If you need further assistance, please provide the Unity version and additional context for both environments.

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

Still not working with 4.1.0-alpha.11 and Samples 0.20.0-exp.

Hi! With your current versions of Needle Engine (4.1.0-alpha.11) and Samples (0.20.0-exp), let’s check further details to troubleshoot the font issue.

  1. Font Asset Settings: Ensure that in both environments, the RobotoSlab-Regular font asset has the same settings. Especially verify if the Character Set is properly configured to include all characters.

  2. Reimport Project: You can try reimporting the project assets on the machine where it fails. Sometimes, cached data may cause issues, and a reimport may resolve it.

  3. Disable Write Protection: If the sample is write-protected, create a local copy of the font asset, disable write protection, and adjust the settings to see if that resolves the issue.

  4. Clear Cache: Clear the Unity cache on the problematic machine. Sometimes, issues arise from corrupted cache files.

  5. Check for Updates: Ensure both your Unity Editor and Needle Engine are up-to-date. Sometimes, specific versions have bugs that get fixed in later updates.

  6. Log Analysis: Look through the Unity console and editor logs for any additional warnings or errors that might give insight into what is failing during the build process.

If you continue to face issues, consider sharing any additional errors or warnings that appear in the logs. This could provide more context for troubleshooting.

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

Hi, could you DM me this logfile? It was not included in the last report but according to the logs it might contain information about an npm error.

C:\Users\Leupold\AppData\Local\npm-cache\_logs\2025-01-17T15_24_58_427Z-debug-0.log

To fix this error do the following steps.

  1. Close Unity if open

  2. Clean the Node.js Npm Cache.
    Open the Windows Command Processor window (cmd) as administrator and type:
    npm cache clean --force
    And do it again.
    npm cache clean
    The first command will disable the write protection, sometimes it will delete the cache, but mostly not.

  3. Delete all manually in
    c:\Users[AccountName]\AppData\Local\npm-cache_npx\

  4. Delete all manually in
    UnityProjekt[NeedleEngine Project Folder]\node_modules\

  5. And if there are some files delete them all too.
    UnityProjekt\Library\Needle\Sample\node_modules\

  6. Start your Unity Project and press “Export to Local Browser” to test the result.

This will fix the error “npm ERR! Invalid Version:” too and maybe a lot more problems.

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.