When I copy "Assembly-CSharp.dll" from the "C:\DaggerfallUnity\DaggerfallUnity_Data\Managed" folder into the "DaggerfallAPI" folder in Unity, and rename it to "DaggerfallAPI.dll", I get this error "Assembly 'Assets/DaggerfallAPI/DaggerfallAPI.dll' will not be loaded due to errors:
Unable to resolve reference 'Unity.Localization'. Is the assembly missing or incompatible with the current platform?". Why? How to fix?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
You're encountering this error because the Assembly-CSharp.dll file you copied from Daggerfall Unity is not a standalone API — it's part of a full Unity project and depends on other assemblies (DLLs) like Unity.Localization, DaggerfallWorkshop.dll, UnityEngine.*, etc.
When you rename Assembly-CSharp.dll to DaggerfallAPI.dll and place it in your mod project, Unity tries to load it as a plugin. However, since it's not built for that purpose and has unresolved dependencies, you get errors like:
code
Unable to resolve reference 'Unity.Localization'. Is the assembly missing or incompatible with the current platform?
✅ Correct Way to Access the Daggerfall Unity API
To safely develop mods for Daggerfall Unity, especially when using a separate Unity project, you need to reference only the necessary DLLs from the original build instead of trying to use Assembly-CSharp.dll.
🔧 Step-by-Step Fix: Set Up Your Mod Project Properly
1. Understand the Structure of the Daggerfall Unity Build
The main game logic is split across several DLLs inside:
code
C:\DaggerfallUnity\DaggerfallUnity_Data\Managed
Key DLLs:
DaggerfallWorkshop.dll – Main game code (contains classes like GameManager, PlayerEntity, etc.)
Assembly-CSharp.dll – Auto-generated Unity script assembly; shouldn't be used directly.
UnityEngine.*.dll – Standard Unity engine assemblies.
Unity.Localization.dll – Used by the game for localization.
2. Create a New Unity Mod Project
Make sure you're using the same Unity version as Daggerfall Unity (e.g., Unity 2020.3 LTS).
3. Copy Only Necessary DLLs into Your Mod Project
Instead of copying Assembly-CSharp.dll, copy these DLLs from the Managed folder:
File Name
Purpose
DaggerfallWorkshop.dll
Contains all the game-specific APIs (most important one!)
Unity.Localization.dll
Required if the game uses localization features
Optional but useful:
UnityEngine.CoreModule.dll
UnityEngine.PhysicsModule.dll
UnityEngine.UI.dll
⚠️ Don’t copy all DLLs unless you have a reason — just include what you actually need.
Procedure:
In your mod Unity project, create a folder: Assets/Plugins/Daggerfall
Copy DaggerfallWorkshop.dll and Unity.Localization.dll there.
4. Write Your Script Using the DaggerfallWorkshop Namespace
Now you can write scripts that access Daggerfall Unity’s internal systems:
csharp
using UnityEngine;
using DaggerfallWorkshop.Game; // This will now work!
public class MyFirstModScript : MonoBehaviour
{
void Start()
{
Debug.Log("My First Mod is loaded!");
if (GameManager.IsInitialized)
{
Debug.Log("Current player name: " + GameManager.Instance.PlayerName);
}
}
}
This works because you referenced DaggerfallWorkshop.dll.
5. Build and Package the Mod
Use Daggerfall Unity’s mod system to package your mod:
Create an empty GameObject in your scene.
Add your script component (MyFirstModScript) to it.
Add the Daggerfall Mod component via Add Component > Daggerfall Mod.
Fill in mod metadata (title, author, version).
Go to File > Build Mod and save as MyFirstMod.dfmod.