Hi everyone,
I’m working on a Unity project where I need to load DXF files asynchronously using C#. Everything works perfectly when running the project in the Unity Editor, but I encounter an issue in the standalone build (using Mono as the scripting backend, not IL2CPP).
In the build, I get this error:
Encoding 1252 data could not be found. Make sure you have the correct international codeset assembly installed and enabled in the exe build made in Unity.
My Setup:
- Unity Version: [your Unity version, Unity 6 LTS Version ]
- Scripting Backend: Mono
- Issue occurs only in standalone builds, not in the Unity Editor.
Code Overview:
Here’s a simplified version of the code I’m using to load the DXF file:
private async Task LoadDxfFileAsync(string path, Vector3 position)
{
DxfFile dxf = null;
try
{
dxf = await Task.Run(() =>
{
if (!File.Exists(path))
{
throw new FileNotFoundException($"DXF file not found: {path}");
}
return DxfFile.Load(path); // Directly load in editor
});
}
catch (Exception ex)
{
loadingPanel.SetActive(false);
statusText.text = $"Error loading DXF: {ex.Message}";
Debug.LogError($"Error loading DXF: {ex.Message}");
return;
}
// Process DXF entities on the main thread...
loadingPanel.SetActive(false);
}
What I’ve Tried:
- Confirmed that
Monois selected as the scripting backend. - The DXF file loads without any issues when running in the Unity Editor.
My Questions:
- Why does this error occur only in the build and not in the editor?
- How can I properly include or register the necessary encoding (code page 1252) so that it functions correctly in the build?
Any insights or solutions would be greatly appreciated! Thanks in advance for your help.